aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-04-05 14:08:25 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-04-05 14:08:25 +0000
commit62ab7addb06bbc5b93460eaf2f70a9f8399308d3 (patch)
tree09f8bdb41248f55ca441adb88b20258e73ec1075 /src/gpu
parent569e0435af62bdb88a662fa0592f75673a17afd9 (diff)
export SkDraw::ComputeRectType() and share that with SkGpuDevice
git-svn-id: http://skia.googlecode.com/svn/trunk@1055 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/SkGpuDevice.cpp36
1 files changed, 15 insertions, 21 deletions
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index d102f3f6a4..ce48be63cd 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -647,33 +647,27 @@ void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect,
const SkPaint& paint) {
CHECK_SHOULD_DRAW(draw);
- bool doStroke = paint.getStyle() == SkPaint::kStroke_Style;
- SkScalar width = paint.getStrokeWidth();
-
- /*
- We have special code for hairline strokes, miter-strokes, and fills.
- Anything else we just call our path code.
- */
- bool usePath = doStroke && width > 0 &&
- paint.getStrokeJoin() != SkPaint::kMiter_Join;
- // another reason we might need to call drawPath...
- if (paint.getMaskFilter()) {
- usePath = true;
- }
+ const SkMatrix& matrix = *draw.fMatrix;
+ SkPoint strokeSize;
+ SkDraw::RectType type = SkDraw::ComputeRectType(paint, matrix, &strokeSize);
- if (usePath) {
+ if (SkDraw::kPath_RectType == type) {
SkPath path;
path.addRect(rect);
this->drawPath(draw, path, paint, NULL, true);
- return;
- }
+ } else {
+ GrPaint grPaint;
+ SkAutoCachedTexture act;
+ if (!this->skPaint2GrPaintShader(paint, &act, matrix, &grPaint)) {
+ return;
+ }
- GrPaint grPaint;
- SkAutoCachedTexture act;
- if (!this->skPaint2GrPaintShader(paint, &act, *draw.fMatrix, &grPaint)) {
- return;
+ SkScalar width = paint.getStrokeWidth();
+ if (SkDraw::kFill_RectType == type) {
+ width = -1;
+ }
+ fContext->drawRect(grPaint, Sk2Gr(rect), width);
}
- fContext->drawRect(grPaint, Sk2Gr(rect), doStroke ? width : -1);
}
#include "SkMaskFilter.h"