Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2378)

Unified Diff: cc/output/gl_renderer.cc

Issue 662623003: Stop using AutoScratchTexture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/gl_renderer.cc
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index ac449a46f5df84bc66ffe091b6470f8c6a394cb9..e5462561979c9b724c9273eddbf4c404f8e62773 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -661,10 +661,9 @@ static skia::RefPtr<SkImage> ApplyImageFilter(
desc.fHeight = source.height();
desc.fConfig = kSkia8888_GrPixelConfig;
desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
- GrAutoScratchTexture scratch_texture(
- use_gr_context->context(), desc, GrContext::kExact_ScratchTexMatch);
skia::RefPtr<GrTexture> backing_store =
- skia::AdoptRef(scratch_texture.detach());
+ skia::AdoptRef(use_gr_context->context()->refScratchTexture(
+ desc, GrContext::kExact_ScratchTexMatch));
if (!backing_store) {
TRACE_EVENT_INSTANT0("cc",
"ApplyImageFilter scratch texture allocation failed",
@@ -675,7 +674,7 @@ static skia::RefPtr<SkImage> ApplyImageFilter(
// Create surface to draw into.
skia::RefPtr<SkSurface> surface = skia::AdoptRef(
SkSurface::NewRenderTargetDirect(backing_store->asRenderTarget()));
- skia::RefPtr<SkCanvas> canvas = skia::SharePtr(surface->getCanvas());
+ SkCanvas* canvas = surface->getCanvas();
danakj 2014/10/16 15:34:01 can you leave this as it was? using SharePtr makes
bsalomon 2014/10/16 16:38:56 Done.
// Draw the source bitmap through the filter to the canvas.
SkPaint paint;
@@ -823,10 +822,9 @@ static skia::RefPtr<SkImage> ApplyBlendModeWithBackdrop(
desc.fHeight = source.height();
desc.fConfig = kSkia8888_GrPixelConfig;
desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
- GrAutoScratchTexture scratch_texture(
- use_gr_context->context(), desc, GrContext::kExact_ScratchTexMatch);
skia::RefPtr<GrTexture> backing_store =
- skia::AdoptRef(scratch_texture.detach());
+ skia::AdoptRef(use_gr_context->context()->refScratchTexture(
+ desc, GrContext::kExact_ScratchTexMatch));
if (!backing_store) {
TRACE_EVENT_INSTANT0(
"cc",
@@ -840,7 +838,7 @@ static skia::RefPtr<SkImage> ApplyBlendModeWithBackdrop(
SkSurface::NewRenderTargetDirect(backing_store->asRenderTarget()));
if (!surface)
return skia::RefPtr<SkImage>();
- skia::RefPtr<SkCanvas> canvas = skia::SharePtr(surface->getCanvas());
+ SkCanvas* canvas = surface->getCanvas();
danakj 2014/10/16 15:34:01 ditto
bsalomon 2014/10/16 16:38:57 Done.
// Draw the source bitmap through the filter to the canvas.
canvas->clear(SK_ColorTRANSPARENT);
@@ -1091,7 +1089,7 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame,
// TODO(senorblanco): Cache this value so that we don't have to do it for both
// the surface and its replica. Apply filters to the contents texture.
- skia::RefPtr<SkImage> filter_bitmap;
+ skia::RefPtr<SkImage> filter_image;
SkScalar color_matrix[20];
bool use_color_matrix = false;
if (!quad->filters.IsEmpty()) {
@@ -1111,13 +1109,12 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame,
// in the compositor.
use_color_matrix = true;
} else {
- filter_bitmap =
- ApplyImageFilter(ScopedUseGrContext::Create(this, frame),
- resource_provider_,
- quad->rect.origin(),
- quad->filters_scale,
- filter.get(),
- contents_texture);
+ filter_image = ApplyImageFilter(ScopedUseGrContext::Create(this, frame),
+ resource_provider_,
+ quad->rect.origin(),
+ quad->filters_scale,
+ filter.get(),
+ contents_texture);
}
}
}
@@ -1144,10 +1141,10 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame,
// If blending is applied using shaders, the background texture with
// filters will be used as backdrop for blending operation, so we don't
// need to copy it to the frame buffer.
- filter_bitmap =
+ filter_image =
ApplyBlendModeWithBackdrop(ScopedUseGrContext::Create(this, frame),
resource_provider_,
- filter_bitmap,
+ filter_image,
contents_texture,
background_texture.get(),
quad->shared_quad_state->blend_mode);
@@ -1182,8 +1179,8 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame,
// this draw instead of having a separate copy of the background texture.
scoped_ptr<ResourceProvider::ScopedSamplerGL> contents_resource_lock;
- if (filter_bitmap) {
- GrTexture* texture = filter_bitmap->getTexture();
+ if (filter_image) {
+ GrTexture* texture = filter_image->getTexture();
DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_));
gl_->BindTexture(GL_TEXTURE_2D, texture->getTextureHandle());
} else {
@@ -1441,7 +1438,7 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame,
// Flush the compositor context before the filter bitmap goes out of
// scope, so the draw gets processed before the filter texture gets deleted.
- if (filter_bitmap)
+ if (filter_image)
GLC(gl_, gl_->Flush());
if (CanApplyBlendModeUsingBlendFunc(blend_mode))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698