From 2f5891ea6460675b3c8d08684e1fa8b239bc0a14 Mon Sep 17 00:00:00 2001 From: fmalita Date: Fri, 25 Sep 2015 09:15:55 -0700 Subject: Remove SkBitmapSource To avoid breaking existing SKPs, add a deserialization stub which unflattens SkBitmapSource records to SkImageSources. R=reed@google.com,mtklein@google.com,robertphillips@google.com Review URL: https://codereview.chromium.org/1363913002 --- gm/filterfastbounds.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'gm/filterfastbounds.cpp') diff --git a/gm/filterfastbounds.cpp b/gm/filterfastbounds.cpp index fe06ff1049..dcff05bfcc 100644 --- a/gm/filterfastbounds.cpp +++ b/gm/filterfastbounds.cpp @@ -6,13 +6,14 @@ */ #include "gm.h" -#include "SkBitmapSource.h" #include "SkBlurImageFilter.h" #include "SkDropShadowImageFilter.h" +#include "SkImageSource.h" #include "SkOffsetImageFilter.h" #include "SkPictureImageFilter.h" #include "SkPictureRecorder.h" #include "SkRandom.h" +#include "SkSurface.h" namespace skiagm { @@ -251,24 +252,24 @@ protected: create_paints(pif, &pifPaints); //----------- - // Paints with a BitmapSource as a source - SkBitmap bm; + // Paints with a SkImageSource as a source + SkAutoTUnref surface(SkSurface::NewRasterN32Premul(10, 10)); { SkPaint p; - bm.allocN32Pixels(10, 10); - SkCanvas temp(bm); - temp.clear(SK_ColorYELLOW); + SkCanvas* temp = surface->getCanvas(); + temp->clear(SK_ColorYELLOW); p.setColor(SK_ColorBLUE); - temp.drawRect(SkRect::MakeLTRB(5, 5, 10, 10), p); + temp->drawRect(SkRect::MakeLTRB(5, 5, 10, 10), p); p.setColor(SK_ColorGREEN); - temp.drawRect(SkRect::MakeLTRB(5, 0, 10, 5), p); + temp->drawRect(SkRect::MakeLTRB(5, 0, 10, 5), p); } - SkAutoTUnref bms(SkBitmapSource::Create(bm)); + SkAutoTUnref image(surface->newImageSnapshot()); + SkAutoTUnref imageSource(SkImageSource::Create(image)); SkTArray bmsPaints; - create_paints(bms, &bmsPaints); + create_paints(imageSource, &bmsPaints); //----------- SkASSERT(paints.count() == kNumVertTiles); -- cgit v1.2.3