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

Side by Side Diff: src/gpu/SkGpuDevice.h

Issue 925343002: Swap render target instead of creating a new gpu device for surface copy-on-write (Closed) Base URL: https://skia.googlesource.com/skia.git@skimage-filters-02-use-sksurface-constructor-skgpudevice
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifndef SkGpuDevice_DEFINED 9 #ifndef SkGpuDevice_DEFINED
10 #define SkGpuDevice_DEFINED 10 #define SkGpuDevice_DEFINED
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 /** 43 /**
44 * New device that will create an offscreen renderTarget based on the ImageI nfo and 44 * New device that will create an offscreen renderTarget based on the ImageI nfo and
45 * sampleCount. The Budgeted param controls whether the device's backing sto re counts against 45 * sampleCount. The Budgeted param controls whether the device's backing sto re counts against
46 * the resource cache budget. On failure, returns NULL. 46 * the resource cache budget. On failure, returns NULL.
47 */ 47 */
48 static SkGpuDevice* Create(GrContext*, SkSurface::Budgeted, const SkImageInf o&, 48 static SkGpuDevice* Create(GrContext*, SkSurface::Budgeted, const SkImageInf o&,
49 int sampleCount, const SkSurfaceProps*, unsigned flags = 0); 49 int sampleCount, const SkSurfaceProps*, unsigned flags = 0);
50 50
51 virtual ~SkGpuDevice(); 51 virtual ~SkGpuDevice();
52 52
53 /** Creates a render targetthat can be used as the render target of the devi ce. */
54 static GrRenderTarget* CreateRenderTarget(GrContext* context, SkSurface::Bud geted budgeted,
bsalomon 2015/02/18 14:29:36 Is it possible to just infer the parameters for th
Kimmo Kinnunen 2015/02/18 14:42:54 Yeah, this is just a refactoring. I did not hone i
55 const SkImageInfo& info, int sampl eCount);
56
53 SkGpuDevice* cloneDevice(const SkSurfaceProps& props) { 57 SkGpuDevice* cloneDevice(const SkSurfaceProps& props) {
54 SkBaseDevice* dev = this->onCreateCompatibleDevice(CreateInfo(this->imag eInfo(), 58 SkBaseDevice* dev = this->onCreateCompatibleDevice(CreateInfo(this->imag eInfo(),
55 kGeneral_U sage, 59 kGeneral_U sage,
56 props.pixe lGeometry())); 60 props.pixe lGeometry()));
57 return static_cast<SkGpuDevice*>(dev); 61 return static_cast<SkGpuDevice*>(dev);
58 } 62 }
59 63
60 GrContext* context() const { return fRenderTarget->getContext(); } 64 GrContext* context() const { return fRenderTarget->getContext(); }
61 65
62 // set all pixels to 0 66 // set all pixels to 0
63 void clearAll(); 67 void clearAll();
64 68
69 void swapRenderTarget(GrRenderTarget* newTarget);
70
65 GrRenderTarget* accessRenderTarget() SK_OVERRIDE; 71 GrRenderTarget* accessRenderTarget() SK_OVERRIDE;
66 72
67 SkImageInfo imageInfo() const SK_OVERRIDE { 73 SkImageInfo imageInfo() const SK_OVERRIDE {
68 return fRenderTarget ? fRenderTarget->surfacePriv().info() : SkImageInfo ::MakeUnknown(); 74 return fRenderTarget ? fRenderTarget->surfacePriv().info() : SkImageInfo ::MakeUnknown();
69 } 75 }
70 76
71 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; } 77 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; }
72 78
73 void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE; 79 void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE;
74 virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t coun t, 80 virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t coun t,
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 bool bicubic); 205 bool bicubic);
200 206
201 bool drawDashLine(const SkPoint pts[2], const SkPaint& paint); 207 bool drawDashLine(const SkPoint pts[2], const SkPaint& paint);
202 208
203 static SkPicture::AccelData::Key ComputeAccelDataKey(); 209 static SkPicture::AccelData::Key ComputeAccelDataKey();
204 210
205 typedef SkBaseDevice INHERITED; 211 typedef SkBaseDevice INHERITED;
206 }; 212 };
207 213
208 #endif 214 #endif
OLDNEW
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | src/image/SkSurface_Gpu.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698