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

Unified Diff: src/image/SkSurface_Gpu.cpp

Issue 151183003: remove redundant GrContext parameter to NewRenderTargetDirect (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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 | « include/core/SkSurface.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkSurface_Gpu.cpp
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index e673cef6703aecefbeb8acbdd2b78164247f4f52..719b0c065310ac062159012de6efad57a3ea5027 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -15,7 +15,7 @@ public:
SK_DECLARE_INST_COUNT(SkSurface_Gpu)
SkSurface_Gpu(GrContext*, const SkImageInfo&, int sampleCount);
- SkSurface_Gpu(GrContext*, GrRenderTarget*);
+ SkSurface_Gpu(GrRenderTarget*);
virtual ~SkSurface_Gpu();
virtual SkCanvas* onNewCanvas() SK_OVERRIDE;
@@ -45,9 +45,9 @@ SkSurface_Gpu::SkSurface_Gpu(GrContext* ctx, const SkImageInfo& info,
}
}
-SkSurface_Gpu::SkSurface_Gpu(GrContext* ctx, GrRenderTarget* renderTarget)
+SkSurface_Gpu::SkSurface_Gpu(GrRenderTarget* renderTarget)
: INHERITED(renderTarget->width(), renderTarget->height()) {
- fDevice = SkNEW_ARGS(SkGpuDevice, (ctx, renderTarget));
+ fDevice = SkNEW_ARGS(SkGpuDevice, (renderTarget->getContext(), renderTarget));
if (kRGB_565_GrPixelConfig != renderTarget->config()) {
fDevice->clear(0x0);
@@ -102,14 +102,20 @@ void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) {
///////////////////////////////////////////////////////////////////////////////
-SkSurface* SkSurface::NewRenderTargetDirect(GrContext* ctx,
- GrRenderTarget* target) {
- if (NULL == ctx || NULL == target) {
+SkSurface* SkSurface::NewRenderTargetDirect(GrRenderTarget* target) {
+ if (NULL == target) {
return NULL;
}
+ return SkNEW_ARGS(SkSurface_Gpu, (target));
+}
- return SkNEW_ARGS(SkSurface_Gpu, (ctx, target));
+#ifdef SK_SUPPORT_LEGACY_NEWRENDERTARGETDIRECT
+SkSurface* SkSurface::NewRenderTargetDirect(GrContext* ctx,
+ GrRenderTarget* target) {
+ SkASSERT(target->getContext() == ctx);
+ return SkSurface::NewRenderTargetDirect(target);
}
+#endif
SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, const SkImageInfo& info, int sampleCount) {
if (NULL == ctx) {
@@ -130,5 +136,5 @@ SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, const SkImageInfo& info, i
return NULL;
}
- return SkNEW_ARGS(SkSurface_Gpu, (ctx, tex->asRenderTarget()));
+ return SkNEW_ARGS(SkSurface_Gpu, (tex->asRenderTarget()));
}
« no previous file with comments | « include/core/SkSurface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698