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

Unified Diff: src/gpu/SkGpuDevice.h

Issue 848903004: Require budget decision when creating a RenderTarget SkSurface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix warning Created 5 years, 11 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 | « src/gpu/GrResourceCache2.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.h
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index 56dad1b475f3c57c23e6b392b2236693e7c17a23..6cbf628e58b90724608af7dedc751fe5b60c2c03 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -6,8 +6,6 @@
* found in the LICENSE file.
*/
-
-
#ifndef SkGpuDevice_DEFINED
#define SkGpuDevice_DEFINED
@@ -16,6 +14,7 @@
#include "SkDevice.h"
#include "SkPicture.h"
#include "SkRegion.h"
+#include "SkSurface.h"
#include "GrContext.h"
#include "GrSurfacePriv.h"
@@ -34,25 +33,20 @@ class SK_API SkGpuDevice : public SkBaseDevice {
public:
enum Flags {
kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear
- kDFText_Flag = 1 << 1, //!< Surface should render text using signed distance fields
};
/**
- * Creates an SkGpuDevice from a GrSurface. This will fail if the surface is not a render
- * target. The caller owns a ref on the returned device. If the surface is cached,
- * the kCached_Flag should be specified to make the device responsible for unlocking
- * the surface when it is released.
+ * Creates an SkGpuDevice from a GrRenderTarget.
*/
- static SkGpuDevice* Create(GrSurface* surface, const SkSurfaceProps&, unsigned flags = 0);
+ static SkGpuDevice* Create(GrRenderTarget* target, const SkSurfaceProps*, unsigned flags = 0);
/**
- * New device that will create an offscreen renderTarget based on the
- * ImageInfo and sampleCount. The device's storage will not
- * count against the GrContext's texture cache budget. The device's pixels
- * will be uninitialized. On failure, returns NULL.
+ * New device that will create an offscreen renderTarget based on the ImageInfo and
+ * sampleCount. The Budgeted param controls whether the device's backing store counts against
+ * the resource cache budget. On failure, returns NULL.
*/
- static SkGpuDevice* Create(GrContext*, const SkImageInfo&, const SkSurfaceProps&,
- int sampleCount);
+ static SkGpuDevice* Create(GrContext*, SkSurface::Budgeted, const SkImageInfo&,
+ int sampleCount, const SkSurfaceProps*, unsigned flags = 0);
virtual ~SkGpuDevice();
@@ -63,7 +57,7 @@ public:
return static_cast<SkGpuDevice*>(dev);
}
- GrContext* context() const { return fContext; }
+ GrContext* context() const { return fRenderTarget->getContext(); }
// set all pixels to 0
void clearAll();
@@ -74,6 +68,8 @@ public:
return fRenderTarget ? fRenderTarget->surfacePriv().info() : SkImageInfo::MakeUnknown();
}
+ const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; }
+
void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE;
virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t count,
const SkPoint[], const SkPaint& paint) SK_OVERRIDE;
@@ -139,21 +135,16 @@ protected:
private:
GrContext* fContext;
-
GrSkDrawProcs* fDrawProcs;
-
GrClipData fClipData;
-
GrTextContext* fTextContext;
-
- // state for our render-target
+ SkSurfaceProps fSurfaceProps;
GrRenderTarget* fRenderTarget;
- uint32_t fFlags;
-
// remove when our clients don't rely on accessBitmap()
- SkBitmap fLegacyBitmap;
+ SkBitmap fLegacyBitmap;
+ bool fNeedClear;
- SkGpuDevice(GrSurface*, const SkSurfaceProps&, unsigned flags = 0);
+ SkGpuDevice(GrRenderTarget*, const SkSurfaceProps*, unsigned flags);
SkBaseDevice* onCreateCompatibleDevice(const CreateInfo&) SK_OVERRIDE;
« no previous file with comments | « src/gpu/GrResourceCache2.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698