Commit 0691c676 authored by Greg Daniel's avatar Greg Daniel Committed by Commit Bot

Switch callers to use getBackendTexture on SkSurface.

getTextureHandle on SkSurface is deprecated so moving chrome over to the
new API.

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2;master.tryserver.chromium.linux:linux_vr
Change-Id: I55ec116814dbd62237b573da44938bc0a8fe877e
Reviewed-on: https://chromium-review.googlesource.com/1010534Reviewed-by: default avatarFlorin Malita <fmalita@chromium.org>
Reviewed-by: default avatarJustin Novosad <junov@chromium.org>
Reviewed-by: default avatarBrian Salomon <bsalomon@chromium.org>
Reviewed-by: default avatarChristopher Grant <cjgrant@chromium.org>
Reviewed-by: default avatarEric Karl <ericrk@chromium.org>
Commit-Queue: Greg Daniel <egdaniel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551373}
parent 32d01db2
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "gpu/command_buffer/client/gles2_interface.h" #include "gpu/command_buffer/client/gles2_interface.h"
#include "gpu/command_buffer/client/raster_interface.h" #include "gpu/command_buffer/client/raster_interface.h"
#include "gpu/command_buffer/common/gpu_memory_buffer_support.h" #include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
#include "skia/ext/texture_handle.h"
#include "third_party/skia/include/core/SkMultiPictureDraw.h" #include "third_party/skia/include/core/SkMultiPictureDraw.h"
#include "third_party/skia/include/core/SkPictureRecorder.h" #include "third_party/skia/include/core/SkPictureRecorder.h"
#include "third_party/skia/include/core/SkSurface.h" #include "third_party/skia/include/core/SkSurface.h"
...@@ -85,12 +84,17 @@ class ScopedSkSurfaceForUnpremultiplyAndDither { ...@@ -85,12 +84,17 @@ class ScopedSkSurfaceForUnpremultiplyAndDither {
if (!surface_) if (!surface_)
return; return;
GrBackendObject handle = GrBackendTexture backend_texture =
surface_->getTextureHandle(SkSurface::kFlushRead_BackendHandleAccess); surface_->getBackendTexture(SkSurface::kFlushRead_BackendHandleAccess);
const GrGLTextureInfo* info = if (!backend_texture.isValid()) {
skia::GrBackendObjectToGrGLTextureInfo(handle); return;
}
GrGLTextureInfo info;
if (!backend_texture.getGLTextureInfo(&info)) {
return;
}
context_provider_->ContextGL()->UnpremultiplyAndDitherCopyCHROMIUM( context_provider_->ContextGL()->UnpremultiplyAndDitherCopyCHROMIUM(
info->fID, texture_id_, offset_.x(), offset_.y(), size_.width(), info.fID, texture_id_, offset_.x(), offset_.y(), size_.width(),
size_.height()); size_.height());
} }
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
#include "chrome/browser/vr/ganesh_surface_provider.h" #include "chrome/browser/vr/ganesh_surface_provider.h"
#include "skia/ext/texture_handle.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 "ui/gfx/geometry/size.h" #include "ui/gfx/geometry/size.h"
#include "ui/gl/gl_implementation.h" #include "ui/gl/gl_implementation.h"
...@@ -43,11 +43,13 @@ sk_sp<SkSurface> GaneshSurfaceProvider::MakeSurface(const gfx::Size& size) { ...@@ -43,11 +43,13 @@ sk_sp<SkSurface> GaneshSurfaceProvider::MakeSurface(const gfx::Size& size) {
GLuint GaneshSurfaceProvider::FlushSurface(SkSurface* surface, GLuint GaneshSurfaceProvider::FlushSurface(SkSurface* surface,
GLuint reuse_texture_id) { GLuint reuse_texture_id) {
surface->getCanvas()->flush(); surface->getCanvas()->flush();
GrBackendObject backend_object = GrBackendTexture backend_texture =
surface->getTextureHandle(SkSurface::kFlushRead_BackendHandleAccess); surface->getBackendTexture(SkSurface::kFlushRead_BackendHandleAccess);
DCHECK_NE(backend_object, 0); DCHECK(backend_texture.isValid());
GLuint texture_id = GrGLTextureInfo info;
skia::GrBackendObjectToGrGLTextureInfo(backend_object)->fID; bool result = backend_texture.getGLTextureInfo(&info);
DCHECK(result);
GLuint texture_id = info.fID;
DCHECK_NE(texture_id, 0u); DCHECK_NE(texture_id, 0u);
surface->getCanvas()->getGrContext()->resetContext(); surface->getCanvas()->getGrContext()->resetContext();
glBindFramebufferEXT(GL_FRAMEBUFFER, main_fbo_); glBindFramebufferEXT(GL_FRAMEBUFFER, main_fbo_);
......
...@@ -48,10 +48,16 @@ class CanvasResourceProvider_Texture : public CanvasResourceProvider { ...@@ -48,10 +48,16 @@ class CanvasResourceProvider_Texture : public CanvasResourceProvider {
bool IsAccelerated() const final { return true; } bool IsAccelerated() const final { return true; }
GLuint GetBackingTextureHandleForOverwrite() override { GLuint GetBackingTextureHandleForOverwrite() override {
return skia::GrBackendObjectToGrGLTextureInfo( GrBackendTexture backend_texture = GetSkSurface()->getBackendTexture(
GetSkSurface()->getTextureHandle( SkSurface::kDiscardWrite_TextureHandleAccess);
SkSurface::kDiscardWrite_TextureHandleAccess)) if (!backend_texture.isValid()) {
->fID; return 0;
}
GrGLTextureInfo info;
if (!backend_texture.getGLTextureInfo(&info)) {
return 0;
}
return info.fID;
} }
protected: protected:
......
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