draw_checks(&canvasTmp, 40, 40);
for (unsigned i = 0; i < NUM_CONFIGS; ++i) {
- if (!src.deepCopyTo(&fDst[i], gConfigs[i])) {
- src.copyTo(&fDst[i], gConfigs[i]);
- }
+ src.copyTo(&fDst[i], gConfigs[i]);
}
canvas->clear(0xFFDDDDDD);
// need to copy for deferred drawing test to work
SkBitmap bm2;
- bm.deepCopyTo(&bm2, SkBitmap::kA8_Config);
+ bm.deepCopyTo(&bm2);
canvas->drawBitmap(bm2,
SK_Scalar1 * mask.fBounds.fLeft,
class SkRegion;
class SkString;
+#define SK_SUPPORT_DEEPCOPYTO_CONFIG
+
class GrTexture;
/** \class SkBitmap
* gpu (typically as a texture), the it will do the same for the dst.
* If the request cannot be fulfilled, returns false and dst is unmodified.
*/
+#ifndef SK_SUPPORT_DEEPCOPYTO_CONFIG
+private:
+#endif
bool deepCopyTo(SkBitmap* dst, Config c) const;
+public:
+
+ /** Makes a deep copy of this bitmap, keeping the copied pixels
+ * in the same domain as the source: If the src pixels are allocated for
+ * the cpu, then so will the dst. If the src pixels are allocated on the
+ * gpu (typically as a texture), the it will do the same for the dst.
+ * If the request cannot be fulfilled, returns false and dst is unmodified.
+ */
+ bool deepCopyTo(SkBitmap* dst) const;
/** Returns true if this bitmap can be deep copied into the requested config
by calling copyTo().
}
}
+bool SkBitmap::deepCopyTo(SkBitmap* dst) const {
+ return this->deepCopyTo(dst, this->config());
+}
+
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// copiedBitmap.setPixelRef(sharedPixelRef, originalBitmap.pixelRefOffset());
} else if (originalBitmap.empty()) {
copiedBitmap.reset();
- } else if (!originalBitmap.deepCopyTo(&copiedBitmap, originalBitmap.config())) {
+ } else if (!originalBitmap.deepCopyTo(&copiedBitmap)) {
return false;
}
copiedBitmap.setImmutable();
fBitmap.allocPixels();
} else {
SkBitmap prev(fBitmap);
- prev.deepCopyTo(&fBitmap, prev.config());
+ prev.deepCopyTo(&fBitmap);
}
// Now fBitmap is a deep copy of itself (and therefore different from
// what is being used by the image. Next we update the canvas to use
if (bitmap.isImmutable()) {
fBitmap = bitmap;
} else {
- bitmap.deepCopyTo(&fBitmap, bitmap.config());
+ bitmap.deepCopyTo(&fBitmap);
fBitmap.setImmutable();
}
// Extract a subset. If this succeeds we will test copying the subset.
SkBitmap subset;
+#ifdef SK_SUPPORT_DEEPCOPYTO_CONFIG
const bool extracted = src.extractSubset(&subset, subsetRect);
for (size_t j = 0; j < SK_ARRAY_COUNT(gPairs); j++) {
true);
}
} // for (size_t j = ...
+#endif
} // for (size_t i = ...
} // GrContextFactory::GLContextType
}