diff options
author | reed <reed@google.com> | 2016-01-08 08:23:19 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-08 08:23:19 -0800 |
commit | 91b4dfbb2fe995db8404fe881a99d4d3d36fee71 (patch) | |
tree | 80a7a7a053393813e8c9b8647ec7d7863ba9720d /samplecode | |
parent | 27a48dc0cddad7f3531dcf0d39d290e7233e3e76 (diff) |
remove MPD for now, to simplify things
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1564343003
Review URL: https://codereview.chromium.org/1564343003
Diffstat (limited to 'samplecode')
-rw-r--r-- | samplecode/SampleApp.cpp | 62 | ||||
-rw-r--r-- | samplecode/SampleApp.h | 2 |
2 files changed, 9 insertions, 55 deletions
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index 199d18e416..9f0bd4524c 100644 --- a/samplecode/SampleApp.cpp +++ b/samplecode/SampleApp.cpp @@ -840,7 +840,7 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev #endif fUseClip = false; - fUseMPD = false; + fUsePicture = false; fAnimating = false; fRotate = false; fPerspAnim = false; @@ -1308,7 +1308,7 @@ SkCanvas* SampleWindow::beforeChildren(SkCanvas* canvas) { canvas = fPDFDocument->beginPage(this->width(), this->height()); } else if (fSaveToSKP) { canvas = fRecorder.beginRecording(9999, 9999, nullptr, 0); - } else if (fUseMPD) { + } else if (fUsePicture) { canvas = fRecorder.beginRecording(9999, 9999, nullptr, 0); } else { canvas = this->INHERITED::beforeChildren(canvas); @@ -1370,9 +1370,10 @@ void SampleWindow::afterChildren(SkCanvas* orig) { return; } - if (fUseMPD) { + if (fUsePicture) { SkAutoTUnref<const SkPicture> picture(fRecorder.endRecording()); + // serialize/deserialize? if (false) { SkDynamicMemoryWStream wstream; picture->serialize(&wstream); @@ -1380,54 +1381,7 @@ void SampleWindow::afterChildren(SkCanvas* orig) { SkAutoTDelete<SkStream> rstream(wstream.detachAsStream()); picture.reset(SkPicture::CreateFromStream(rstream)); } - - if (true) { - 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())); - c->concat(orig->getTotalMatrix()); - md.add(c, picture, nullptr, nullptr); - 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); - - SkAutoDataUnref data(ostream.copyToData()); - SkMemoryStream istream(data->data(), data->size()); - SkAutoTUnref<SkPicture> pict(SkPicture::CreateFromStream(&istream)); - if (pict.get() != nullptr) { - orig->drawPicture(pict.get()); - } - } else { - picture->playback(orig); - } + orig->drawPicture(picture); } // Do this after presentGL and other finishing, rather than in afterChild @@ -1772,7 +1726,7 @@ bool SampleWindow::onHandleChar(SkUnichar uni) { this->inval(nullptr); return true; case 'M': - fUseMPD = !fUseMPD; + fUsePicture = !fUsePicture; this->inval(nullptr); this->updateTitle(); return true; @@ -2043,8 +1997,8 @@ void SampleWindow::updateTitle() { if (this->getSurfaceProps().flags() & SkSurfaceProps::kUseDeviceIndependentFonts_Flag) { title.prepend("<DIF> "); } - if (fUseMPD) { - title.prepend("<MPD> "); + if (fUsePicture) { + title.prepend("<P> "); } title.prepend(trystate_str(fLCDState, "LCD ", "lcd ")); diff --git a/samplecode/SampleApp.h b/samplecode/SampleApp.h index 44085b5ac1..56cf98428b 100644 --- a/samplecode/SampleApp.h +++ b/samplecode/SampleApp.h @@ -180,7 +180,7 @@ private: SkAutoTUnref<SkDocument> fPDFDocument; bool fUseClip; - bool fUseMPD; + bool fUsePicture; bool fAnimating; bool fRotate; bool fPerspAnim; |