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 @@
#include "gpu/command_buffer/client/gles2_interface.h"
#include "gpu/command_buffer/client/raster_interface.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/SkPictureRecorder.h"
#include "third_party/skia/include/core/SkSurface.h"
......@@ -85,12 +84,17 @@ class ScopedSkSurfaceForUnpremultiplyAndDither {
if (!surface_)
return;
GrBackendObject handle =
surface_->getTextureHandle(SkSurface::kFlushRead_BackendHandleAccess);
const GrGLTextureInfo* info =
skia::GrBackendObjectToGrGLTextureInfo(handle);
GrBackendTexture backend_texture =
surface_->getBackendTexture(SkSurface::kFlushRead_BackendHandleAccess);
if (!backend_texture.isValid()) {
return;
}
GrGLTextureInfo info;
if (!backend_texture.getGLTextureInfo(&info)) {
return;
}
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());
}
......
......@@ -4,9 +4,9 @@
#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/SkSurface.h"
#include "third_party/skia/include/gpu/GrBackendSurface.h"
#include "third_party/skia/include/gpu/GrContext.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gl/gl_implementation.h"
......@@ -43,11 +43,13 @@ sk_sp<SkSurface> GaneshSurfaceProvider::MakeSurface(const gfx::Size& size) {
GLuint GaneshSurfaceProvider::FlushSurface(SkSurface* surface,
GLuint reuse_texture_id) {
surface->getCanvas()->flush();
GrBackendObject backend_object =
surface->getTextureHandle(SkSurface::kFlushRead_BackendHandleAccess);
DCHECK_NE(backend_object, 0);
GLuint texture_id =
skia::GrBackendObjectToGrGLTextureInfo(backend_object)->fID;
GrBackendTexture backend_texture =
surface->getBackendTexture(SkSurface::kFlushRead_BackendHandleAccess);
DCHECK(backend_texture.isValid());
GrGLTextureInfo info;
bool result = backend_texture.getGLTextureInfo(&info);
DCHECK(result);
GLuint texture_id = info.fID;
DCHECK_NE(texture_id, 0u);
surface->getCanvas()->getGrContext()->resetContext();
glBindFramebufferEXT(GL_FRAMEBUFFER, main_fbo_);
......
......@@ -48,10 +48,16 @@ class CanvasResourceProvider_Texture : public CanvasResourceProvider {
bool IsAccelerated() const final { return true; }
GLuint GetBackingTextureHandleForOverwrite() override {
return skia::GrBackendObjectToGrGLTextureInfo(
GetSkSurface()->getTextureHandle(
SkSurface::kDiscardWrite_TextureHandleAccess))
->fID;
GrBackendTexture backend_texture = GetSkSurface()->getBackendTexture(
SkSurface::kDiscardWrite_TextureHandleAccess);
if (!backend_texture.isValid()) {
return 0;
}
GrGLTextureInfo info;
if (!backend_texture.getGLTextureInfo(&info)) {
return 0;
}
return info.fID;
}
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