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

Unified Diff: src/core/SkPicture.cpp

Issue 251533004: First pass at GPU veto (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 8 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
Index: src/core/SkPicture.cpp
===================================================================
--- src/core/SkPicture.cpp (revision 14349)
+++ src/core/SkPicture.cpp (working copy)
@@ -122,17 +122,19 @@
///////////////////////////////////////////////////////////////////////////////
-SkPicture::SkPicture() {
+SkPicture::SkPicture()
+ : fAccelData(NULL)
+ , fContentFlags(0) {
this->needsNewGenID();
fRecord = NULL;
fPlayback = NULL;
fWidth = fHeight = 0;
- fAccelData = NULL;
}
SkPicture::SkPicture(const SkPicture& src)
: INHERITED()
- , fAccelData(NULL) {
+ , fAccelData(NULL)
+ , fContentFlags(src.fContentFlags) {
this->needsNewGenID();
fWidth = src.fWidth;
fHeight = src.fHeight;
@@ -207,6 +209,7 @@
SkTSwap(fWidth, other.fWidth);
SkTSwap(fHeight, other.fHeight);
fPathHeap.swap(&other.fPathHeap);
+ SkTSwap(fContentFlags, other.fContentFlags);
}
SkPicture* SkPicture::clone() const {
@@ -228,6 +231,7 @@
clone->fHeight = fHeight;
SkSafeSetNull(clone->fRecord);
SkDELETE(clone->fPlayback);
+ clone->fContentFlags = fContentFlags;
/* We want to copy the src's playback. However, if that hasn't been built
yet, we need to fake a call to endRecording() without actually calling
@@ -271,6 +275,7 @@
}
SkSafeUnref(fAccelData);
SkSafeSetNull(fRecord);
+ fContentFlags = 0;
this->needsNewGenID();
@@ -305,6 +310,7 @@
SkSafeUnref(fAccelData);
SkSafeSetNull(fRecord);
SkASSERT(NULL == fPathHeap);
+ fContentFlags = 0;
this->needsNewGenID();
@@ -452,7 +458,8 @@
, fRecord(NULL)
, fWidth(width)
, fHeight(height)
- , fAccelData(NULL) {
+ , fAccelData(NULL)
+ , fContentFlags(0) {
this->needsNewGenID();
}
@@ -465,6 +472,8 @@
SkPicture* newPict = SkNEW_ARGS(SkPicture, (NULL, info.fWidth, info.fHeight));
+ newPict->fContentFlags = info.fFlags & ~SkPictInfo::kAll_Mask;
+
// Check to see if there is a playback to recreate.
if (stream->readBool()) {
SkPicturePlayback* playback = SkPicturePlayback::CreateFromStream(newPict, stream,
@@ -488,6 +497,8 @@
SkPicture* newPict = SkNEW_ARGS(SkPicture, (NULL, info.fWidth, info.fHeight));
+ newPict->fContentFlags = info.fFlags & ~SkPictInfo::kAll_Mask;
+
// Check to see if there is a playback to recreate.
if (buffer.readBool()) {
SkPicturePlayback* playback = SkPicturePlayback::CreateFromBuffer(newPict, buffer, info);
@@ -511,7 +522,9 @@
info->fVersion = CURRENT_PICTURE_VERSION;
info->fWidth = fWidth;
info->fHeight = fHeight;
- info->fFlags = SkPictInfo::kCrossProcess_Flag;
+ SkASSERT((fContentFlags & SkPictInfo::kAll_Mask) == 0);
+
+ info->fFlags = fContentFlags | SkPictInfo::kCrossProcess_Flag;
// TODO: remove this flag, since we're always float (now)
info->fFlags |= SkPictInfo::kScalarIsFloat_Flag;
@@ -602,8 +615,7 @@
#if SK_SUPPORT_GPU
bool SkPicture::suitableForGpuRasterization(GrContext* context) const {
- // Stub for now; never veto GPu rasterization.
- return true;
+ return !this->getHasPathEffects();
}
#endif

Powered by Google App Engine
This is Rietveld 408576698