Index: samplecode/SampleApp.cpp |
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp |
index 2c17379f8803d4081036b22011d896e845a6bcb9..1b4a55e5dd0a88d93d6fc730e9223d20e9c6528d 100644 |
--- a/samplecode/SampleApp.cpp |
+++ b/samplecode/SampleApp.cpp |
@@ -742,6 +742,8 @@ DEFINE_bool(list, false, "List samples?"); |
DEFINE_string(pdfPath, "", "Path to direcotry of pdf files."); |
#endif |
+#include "SkTaskGroup.h" |
+ |
SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* devManager) |
: INHERITED(hwnd) |
, fDevManager(NULL) { |
@@ -813,6 +815,7 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev |
fCurrIndex = 0; |
} |
+ static SkTaskGroup::Enabler enabled(-1); |
gSampleWindow = this; |
#ifdef PIPE_FILE |
@@ -1306,7 +1309,7 @@ SkCanvas* SampleWindow::beforeChildren(SkCanvas* canvas) { |
return canvas; |
} |
- |
+#include "SkMultiPictureDraw.h" |
void SampleWindow::afterChildren(SkCanvas* orig) { |
if (fSaveToPdf) { |
fSaveToPdf = false; |
@@ -1336,7 +1339,39 @@ void SampleWindow::afterChildren(SkCanvas* orig) { |
if (true) { |
this->installDrawFilter(orig); |
- orig->drawPicture(picture); |
+ |
+ if (true) { |
+ SkImageInfo info; |
+ size_t rowBytes; |
+ void* addr = orig->accessTopLayerPixels(&info, &rowBytes); |
+ if (addr) { |
+ SkSurface* surfs[4]; |
+ SkMultiPictureDraw md; |
+ |
+ SkImageInfo n = SkImageInfo::Make(info.width()/2, info.height()/2, |
+ info.colorType(), info.alphaType()); |
+ int index = 0; |
+ for (int y = 0; y < 2; ++y) { |
+ for (int x = 0; x < 2; ++x) { |
+ char* p = (char*)addr; |
+ p += y * n.height() * rowBytes; |
+ p += x * n.width() * sizeof(SkPMColor); |
+ surfs[index] = SkSurface::NewRasterDirect(n, p, rowBytes); |
+ SkCanvas* c = surfs[index]->getCanvas(); |
+ c->translate(SkIntToScalar(-x * n.width()), |
+ SkIntToScalar(-y * n.height())); |
+ md.add(c, picture, NULL, NULL); |
+ index++; |
+ } |
+ } |
+ md.draw(); |
+ for (int i = 0; i < 4; ++i) { |
+ surfs[i]->unref(); |
+ } |
+ } |
+ } else { |
+ orig->drawPicture(picture); |
+ } |
} else if (true) { |
SkDynamicMemoryWStream ostream; |
picture->serialize(&ostream); |