aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-11 19:39:09 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-11 19:39:09 +0000
commit3ab43d5c5b4d77f46dd0266618f92e5fefce2021 (patch)
tree2950bae414b8cc85a61d350f945ccc55affd52d6 /include
parent5dc26b97366934ba0f896cea02a3fec027d5d5c1 (diff)
Minimize use of SkDraw's matrix in SkGpuDevice.
R=robertphillips@google.com Review URL: https://codereview.appspot.com/6604068 git-svn-id: http://skia.googlecode.com/svn/trunk@5906 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkClipStack.h7
-rw-r--r--include/core/SkRect.h7
-rw-r--r--include/gpu/SkGpuDevice.h25
3 files changed, 30 insertions, 9 deletions
diff --git a/include/core/SkClipStack.h b/include/core/SkClipStack.h
index 2ab118d5a7..a67e0a5dd9 100644
--- a/include/core/SkClipStack.h
+++ b/include/core/SkClipStack.h
@@ -63,6 +63,13 @@ public:
BoundsType* boundType,
bool* isIntersectionOfRects = NULL) const;
+ /**
+ * Takes an input rect in device space and conservatively clips it to the
+ * clip-stack. If false is returned then the rect does not intersect the
+ * clip and is unmodified.
+ */
+ bool intersectRectWithClip(SkRect* devRect) const;
+
void clipDevRect(const SkIRect& ir, SkRegion::Op op) {
SkRect r;
r.set(ir);
diff --git a/include/core/SkRect.h b/include/core/SkRect.h
index 23af56006c..21a37364d4 100644
--- a/include/core/SkRect.h
+++ b/include/core/SkRect.h
@@ -481,6 +481,13 @@ struct SK_API SkRect {
fBottom = y + height;
}
+ void setWH(SkScalar width, SkScalar height) {
+ fLeft = 0;
+ fTop = 0;
+ fRight = width;
+ fBottom = height;
+ }
+
/**
* Make the largest representable rectangle
*/
diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h
index b941894221..558468ca3e 100644
--- a/include/gpu/SkGpuDevice.h
+++ b/include/gpu/SkGpuDevice.h
@@ -145,26 +145,33 @@ private:
bool bindDeviceAsTexture(GrPaint* paint);
void prepareDraw(const SkDraw&); // sets the render target, clip, and matrix on GrContext.
+
+ /**
+ * Implementation for both drawBitmap and drawBitmapRect.
+ */
+ void drawBitmapCommon(const SkDraw&,
+ const SkBitmap& bitmap,
+ const SkRect* srcRectPtr,
+ const SkMatrix&,
+ const SkPaint&);
+
+ /**
+ * Helper functions called by drawBitmapCommon. By the time these are called the SkDraw's
+ * matrix has already been set on GrContext
+ */
bool shouldTileBitmap(const SkBitmap& bitmap,
const GrTextureParams& sampler,
const SkRect* srcRectPtr) const;
- void internalDrawBitmap(const SkDraw&,
- const SkBitmap&,
+ void internalDrawBitmap(const SkBitmap&,
const SkRect&,
const SkMatrix&,
const GrTextureParams& params,
GrPaint* grPaint);
- void drawTiledBitmap(const SkDraw& draw,
- const SkBitmap& bitmap,
+ void drawTiledBitmap(const SkBitmap& bitmap,
const SkRect& srcRect,
const SkMatrix& m,
const GrTextureParams& params,
GrPaint* grPaint);
- void drawBitmapCommon(const SkDraw&,
- const SkBitmap& bitmap,
- const SkRect* srcRectPtr,
- const SkMatrix&,
- const SkPaint&);
/**
* Returns non-initialized instance.