aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkDevice.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-29 21:26:13 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-29 21:26:13 +0000
commit405d0f43d8fa03874aee23669e5fdb38f21cc3e7 (patch)
treeeb0a7c1c4787c3a5545837e76d11982af482639a /src/core/SkDevice.cpp
parentbae9ff70d911e1c1fe1db776f2640b45e9d5e749 (diff)
In which a series of things around attachToCanvas and writePixels are fixed
Review URL: https://codereview.appspot.com/6506051/ git-svn-id: http://skia.googlecode.com/svn/trunk@5341 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkDevice.cpp')
-rw-r--r--src/core/SkDevice.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index f8bed65e42..10d89d591f 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -9,6 +9,7 @@
#include "SkDraw.h"
#include "SkImageFilter.h"
#include "SkMetaData.h"
+#include "SkRasterClip.h"
#include "SkRect.h"
SK_DEFINE_INST_COUNT(SkDevice)
@@ -299,8 +300,13 @@ void SkDevice::writePixels(const SkBitmap& bitmap,
SkPaint paint;
paint.setXfermodeMode(SkXfermode::kSrc_Mode);
- SkCanvas canvas(this);
- canvas.drawSprite(*sprite, x, y, &paint);
+ SkRasterClip clip(SkIRect::MakeWH(fBitmap.width(), fBitmap.height()));
+ SkDraw draw;
+ draw.fRC = &clip;
+ draw.fClip = &clip.bwRgn();
+ draw.fBitmap = &fBitmap; // canvas should have already called accessBitmap
+ draw.fMatrix = &SkMatrix::I();
+ this->drawSprite(draw, *sprite, x, y, paint);
}
///////////////////////////////////////////////////////////////////////////////