Commit 22ec9a55 authored by Brian Salomon's avatar Brian Salomon Committed by Commit Bot

Use GrBackendTexture rather than GrBackendTextureDesc in cc

GrBackendTextureDesc is being phased out.

Change-Id: I0c2d00b0a80c63037ecc937021ef8bf978f4c359
Reviewed-on: https://chromium-review.googlesource.com/563119Reviewed-by: default avatarEric Karl <ericrk@chromium.org>
Commit-Queue: Brian Salomon <bsalomon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486231}
parent 2a4dc1da
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
#include "third_party/skia/include/core/SkColorFilter.h" #include "third_party/skia/include/core/SkColorFilter.h"
#include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkSurface.h" #include "third_party/skia/include/core/SkSurface.h"
#include "third_party/skia/include/gpu/GrBackendSurface.h"
#include "third_party/skia/include/gpu/GrContext.h" #include "third_party/skia/include/gpu/GrContext.h"
#include "third_party/skia/include/gpu/gl/GrGLInterface.h" #include "third_party/skia/include/gpu/gl/GrGLInterface.h"
#include "third_party/skia/include/gpu/gl/GrGLTypes.h" #include "third_party/skia/include/gpu/gl/GrGLTypes.h"
...@@ -638,20 +639,17 @@ static sk_sp<SkImage> WrapTexture( ...@@ -638,20 +639,17 @@ static sk_sp<SkImage> WrapTexture(
const ResourceProvider::ScopedReadLockGL& lock, const ResourceProvider::ScopedReadLockGL& lock,
GrContext* context, GrContext* context,
bool flip_texture) { bool flip_texture) {
// Wrap a given texture in a Ganesh platform texture. // Wrap a given texture in a Ganesh backend texture.
GrBackendTextureDesc backend_texture_description;
GrGLTextureInfo texture_info; GrGLTextureInfo texture_info;
texture_info.fTarget = lock.target(); texture_info.fTarget = lock.target();
texture_info.fID = lock.texture_id(); texture_info.fID = lock.texture_id();
backend_texture_description.fWidth = lock.size().width(); GrBackendTexture backend_texture(lock.size().width(), lock.size().height(),
backend_texture_description.fHeight = lock.size().height(); kSkia8888_GrPixelConfig, texture_info);
backend_texture_description.fConfig = kSkia8888_GrPixelConfig; GrSurfaceOrigin origin =
backend_texture_description.fTextureHandle =
skia::GrGLTextureInfoToGrBackendObject(texture_info);
backend_texture_description.fOrigin =
flip_texture ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOrigin; flip_texture ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOrigin;
return SkImage::MakeFromTexture(context, backend_texture_description); return SkImage::MakeFromTexture(context, backend_texture, origin,
kPremul_SkAlphaType, nullptr);
} }
static sk_sp<SkImage> ApplyImageFilter( static sk_sp<SkImage> ApplyImageFilter(
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "third_party/khronos/GLES2/gl2ext.h" #include "third_party/khronos/GLES2/gl2ext.h"
#include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkSurface.h" #include "third_party/skia/include/core/SkSurface.h"
#include "third_party/skia/include/gpu/GrBackendSurface.h"
#include "third_party/skia/include/gpu/GrContext.h" #include "third_party/skia/include/gpu/GrContext.h"
#include "third_party/skia/include/gpu/gl/GrGLTypes.h" #include "third_party/skia/include/gpu/gl/GrGLTypes.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
...@@ -1181,15 +1182,9 @@ ResourceProvider::ScopedSkSurfaceProvider::ScopedSkSurfaceProvider( ...@@ -1181,15 +1182,9 @@ ResourceProvider::ScopedSkSurfaceProvider::ScopedSkSurfaceProvider(
GrGLTextureInfo texture_info; GrGLTextureInfo texture_info;
texture_info.fID = texture_provider_.texture_id(); texture_info.fID = texture_provider_.texture_id();
texture_info.fTarget = resource_lock->target(); texture_info.fTarget = resource_lock->target();
GrBackendTextureDesc desc; GrBackendTexture backend_texture(
desc.fFlags = kRenderTarget_GrBackendTextureFlag; resource_lock->size().width(), resource_lock->size().height(),
desc.fWidth = resource_lock->size().width(); ToGrPixelConfig(resource_lock->format()), texture_info);
desc.fHeight = resource_lock->size().height();
desc.fConfig = ToGrPixelConfig(resource_lock->format());
desc.fOrigin = kTopLeft_GrSurfaceOrigin;
desc.fTextureHandle = skia::GrGLTextureInfoToGrBackendObject(texture_info);
desc.fSampleCnt = msaa_sample_count;
uint32_t flags = uint32_t flags =
use_distance_field_text ? SkSurfaceProps::kUseDistanceFieldFonts_Flag : 0; use_distance_field_text ? SkSurfaceProps::kUseDistanceFieldFonts_Flag : 0;
// Use unknown pixel geometry to disable LCD text. // Use unknown pixel geometry to disable LCD text.
...@@ -1200,7 +1195,8 @@ ResourceProvider::ScopedSkSurfaceProvider::ScopedSkSurfaceProvider( ...@@ -1200,7 +1195,8 @@ ResourceProvider::ScopedSkSurfaceProvider::ScopedSkSurfaceProvider(
SkSurfaceProps(flags, SkSurfaceProps::kLegacyFontHost_InitType); SkSurfaceProps(flags, SkSurfaceProps::kLegacyFontHost_InitType);
} }
sk_surface_ = SkSurface::MakeFromBackendTextureAsRenderTarget( sk_surface_ = SkSurface::MakeFromBackendTextureAsRenderTarget(
context_provider->GrContext(), desc, nullptr, &surface_props); context_provider->GrContext(), backend_texture, kTopLeft_GrSurfaceOrigin,
msaa_sample_count, nullptr, &surface_props);
} }
ResourceProvider::ScopedSkSurfaceProvider::~ScopedSkSurfaceProvider() { ResourceProvider::ScopedSkSurfaceProvider::~ScopedSkSurfaceProvider() {
...@@ -1239,15 +1235,14 @@ ResourceProvider::ScopedReadLockSkImage::ScopedReadLockSkImage( ...@@ -1239,15 +1235,14 @@ ResourceProvider::ScopedReadLockSkImage::ScopedReadLockSkImage(
GrGLTextureInfo texture_info; GrGLTextureInfo texture_info;
texture_info.fID = resource->gl_id; texture_info.fID = resource->gl_id;
texture_info.fTarget = resource->target; texture_info.fTarget = resource->target;
GrBackendTexture backend_texture(
resource->size.width(), resource->size.height(),
ToGrPixelConfig(resource->format), texture_info);
GrBackendTextureDesc desc; GrBackendTextureDesc desc;
desc.fWidth = resource->size.width();
desc.fHeight = resource->size.height();
desc.fConfig = ToGrPixelConfig(resource->format);
desc.fOrigin = kTopLeft_GrSurfaceOrigin;
desc.fTextureHandle = skia::GrGLTextureInfoToGrBackendObject(texture_info);
sk_image_ = SkImage::MakeFromTexture( sk_image_ = SkImage::MakeFromTexture(
resource_provider->compositor_context_provider_->GrContext(), desc, resource_provider->compositor_context_provider_->GrContext(),
kPremul_SkAlphaType); backend_texture, kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType,
nullptr);
} else if (resource->pixels) { } else if (resource->pixels) {
SkBitmap sk_bitmap; SkBitmap sk_bitmap;
resource_provider->PopulateSkBitmapWithResource(&sk_bitmap, resource); resource_provider->PopulateSkBitmapWithResource(&sk_bitmap, resource);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment