aboutsummaryrefslogtreecommitdiffstats
path: root/include/core
diff options
context:
space:
mode:
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkBitmap.h16
-rw-r--r--include/core/SkCanvas.h5
2 files changed, 21 insertions, 0 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index 2d5fc41..e125924 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -551,6 +551,17 @@ public:
void flatten(SkFlattenableWriteBuffer&) const;
void unflatten(SkFlattenableReadBuffer&);
+ /** Get the unscaled version of this SkBitmap (may be null; in fact it usually will be)
+ */
+ SkBitmap* unscaledBitmap() const { return fUnscaledBitmap; }
+
+ /** Assign an unscaled bitmap so we can do some transforms with it
+ * TODO do some basic error-checking (make sure URIs match?)
+ */
+ SkBitmap* setUnscaledBitmap(SkBitmap* unscaledBitmap) { return fUnscaledBitmap = unscaledBitmap; }
+
+ void freeUnscaledBitmap();
+
SkDEBUGCODE(void validate() const;)
class Allocator : public SkRefCnt {
@@ -611,6 +622,11 @@ private:
// pixels (e.g. as a gpu texture)
mutable int fRawPixelGenerationID;
+ // Holds shadow copy of this bitmap in cases where it was pre-upscaled, and
+ // we want to retain the original for possible performance improvements in
+ // later transformations
+ mutable SkBitmap* fUnscaledBitmap;
+
enum Flags {
kImageIsOpaque_Flag = 0x01,
kImageIsVolatile_Flag = 0x02,
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 1b9f055..97d6800 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -894,6 +894,9 @@ public:
void setExternalMatrix(const SkMatrix* = NULL);
+ virtual void drawBitmapScalarRect(const SkBitmap& bitmap, const SkRect* src,
+ const SkRect& dst, const SkPaint* paint = NULL);
+
///////////////////////////////////////////////////////////////////////////
/** After calling saveLayer(), there can be any number of devices that make
@@ -983,6 +986,8 @@ private:
const SkPaint* paint);
void internalDrawBitmapRect(const SkBitmap& bitmap, const SkIRect* src,
const SkRect& dst, const SkPaint* paint);
+ void internalDrawBitmapScalarRect(const SkBitmap& bitmap, const SkRect* src,
+ const SkRect& dst, const SkPaint* paint);
void internalDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
const SkRect& dst, const SkPaint* paint);
void internalDrawPaint(const SkPaint& paint);