remove redundant GrContext parameter to NewRenderTargetDirect
BUG=skia: R=bsalomon@google.com Review URL: https://codereview.chromium.org/151183003 git-svn-id: http://skia.googlecode.com/svn/trunk@13299 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
1c9bd55ea3
commit
372b7a4f56
@ -16,6 +16,8 @@ class SkPaint;
|
||||
class GrContext;
|
||||
class GrRenderTarget;
|
||||
|
||||
//#define SK_SUPPORT_LEGACY_NEWRENDERTARGETDIRECT
|
||||
|
||||
/**
|
||||
* SkSurface represents the backend/results of drawing to a canvas. For raster
|
||||
* drawing, the surface will be pixels, but (for example) when drawing into
|
||||
@ -64,11 +66,19 @@ public:
|
||||
* "replayed" into that canvas.
|
||||
*/
|
||||
static SkSurface* NewPicture(int width, int height);
|
||||
|
||||
|
||||
/**
|
||||
* Return a new surface using the specified render target.
|
||||
*/
|
||||
static SkSurface* NewRenderTargetDirect(GrRenderTarget*);
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_NEWRENDERTARGETDIRECT
|
||||
/**
|
||||
* DEPRECATED -- call the single argument version (just rendertarget)
|
||||
* Return a new surface using the specified render target.
|
||||
*/
|
||||
static SkSurface* NewRenderTargetDirect(GrContext*, GrRenderTarget*);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Return a new surface whose contents will be drawn to an offscreen
|
||||
|
@ -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,15 +102,21 @@ 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, (ctx, target));
|
||||
return SkNEW_ARGS(SkSurface_Gpu, (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) {
|
||||
return NULL;
|
||||
@ -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()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user