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

Unified Diff: cc/output/gl_renderer.cc

Issue 315913002: Check the texture allocation for offscreen render targets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase & traces Created 6 years, 6 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 de9cfa76379bada2fb584a14a445e9197c6cb310..80e866df07d723c3ba779737acccac9577f6b93e 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -665,12 +665,18 @@ static SkBitmap ApplyImageFilter(
use_gr_context->context(), desc, GrContext::kExact_ScratchTexMatch);
skia::RefPtr<GrTexture> backing_store =
skia::AdoptRef(scratch_texture.detach());
- if (backing_store.get() == NULL)
+ if (backing_store.get() == NULL) {
+ TRACE_EVENT_INSTANT0("cc",
+ "ApplyImageFilter scratch texture allocation failed",
+ TRACE_EVENT_SCOPE_THREAD);
return SkBitmap();
+ }
// Create a device and canvas using that backing store.
- SkGpuDevice device(use_gr_context->context(), backing_store.get());
- SkCanvas canvas(&device);
+ skia::RefPtr<SkGpuDevice> device =
+ skia::AdoptRef(SkGpuDevice::Create(backing_store->asRenderTarget()));
+ DCHECK(device.get());
+ SkCanvas canvas(device.get());
// Draw the source bitmap through the filter to the canvas.
SkPaint paint;
@@ -688,7 +694,7 @@ static SkBitmap ApplyImageFilter(
// GL context again.
use_gr_context->context()->flush();
- return device.accessBitmap(false);
+ return device->accessBitmap(false);
}
static SkBitmap ApplyBlendModeWithBackdrop(
@@ -785,10 +791,19 @@ static SkBitmap ApplyBlendModeWithBackdrop(
use_gr_context->context(), desc, GrContext::kExact_ScratchTexMatch);
skia::RefPtr<GrTexture> backing_store =
skia::AdoptRef(scratch_texture.detach());
+ if (backing_store.get() == NULL) {
+ TRACE_EVENT_INSTANT0(
+ "cc",
+ "ApplyBlendModeWithBackdrop scratch texture allocation failed",
+ TRACE_EVENT_SCOPE_THREAD);
+ return source_bitmap_with_filters;
+ }
// Create a device and canvas using that backing store.
- SkGpuDevice device(use_gr_context->context(), backing_store.get());
- SkCanvas canvas(&device);
+ skia::RefPtr<SkGpuDevice> device =
+ skia::AdoptRef(SkGpuDevice::Create(backing_store->asRenderTarget()));
+ DCHECK(device.get());
+ SkCanvas canvas(device.get());
// Draw the source bitmap through the filter to the canvas.
canvas.clear(SK_ColorTRANSPARENT);
@@ -802,7 +817,7 @@ static SkBitmap ApplyBlendModeWithBackdrop(
// GL context again.
use_gr_context->context()->flush();
- return device.accessBitmap(false);
+ return device->accessBitmap(false);
}
scoped_ptr<ScopedResource> GLRenderer::GetBackgroundWithFilters(
« 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