aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/filterfastbounds.cpp
diff options
context:
space:
mode:
authorGravatar fmalita <fmalita@chromium.org>2015-09-25 09:15:55 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-09-25 09:15:55 -0700
commit2f5891ea6460675b3c8d08684e1fa8b239bc0a14 (patch)
treeb67a41b8f44935eb74ec797388e4021951b00bfc /gm/filterfastbounds.cpp
parentd114645d931d4e95a938597a45a270f211273c17 (diff)
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
Diffstat (limited to 'gm/filterfastbounds.cpp')
-rw-r--r--gm/filterfastbounds.cpp21
1 files changed, 11 insertions, 10 deletions
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<SkSurface> 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<SkBitmapSource> bms(SkBitmapSource::Create(bm));
+ SkAutoTUnref<SkImage> image(surface->newImageSnapshot());
+ SkAutoTUnref<SkImageFilter> imageSource(SkImageSource::Create(image));
SkTArray<SkPaint> bmsPaints;
- create_paints(bms, &bmsPaints);
+ create_paints(imageSource, &bmsPaints);
//-----------
SkASSERT(paints.count() == kNumVertTiles);