Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: gm/filterfastbounds.cpp

Issue 1363913002: Remove SkBitmapSource (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: immutable bitmap Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/colorcube.cpp ('k') | gm/imagefilterscropped.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/filterfastbounds.cpp
diff --git a/gm/filterfastbounds.cpp b/gm/filterfastbounds.cpp
index fe06ff10498d9e71db129b1d99b532224191fce4..dcff05bfcc91cce616eede72505bf1844acf42a8 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);
« no previous file with comments | « gm/colorcube.cpp ('k') | gm/imagefilterscropped.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698