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

Unified Diff: dm/DMGpuTask.cpp

Issue 168653002: Change device factories to take SkImageInfo instead of SkBitmap::Config (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix PdfViewer Created 6 years, 10 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 | « dm/DMGpuTask.h ('k') | dm/DMPipeTask.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMGpuTask.cpp
diff --git a/dm/DMGpuTask.cpp b/dm/DMGpuTask.cpp
index c0502eeed5e4282c99bb9a1ba22298d278b9f500..f787e2544f1eb9cb0715ca42f87f9e3445dd1fee 100644
--- a/dm/DMGpuTask.cpp
+++ b/dm/DMGpuTask.cpp
@@ -4,7 +4,7 @@
#include "DMUtil.h"
#include "DMWriteTask.h"
#include "SkCommandLineFlags.h"
-#include "SkGpuDevice.h"
+#include "SkSurface.h"
#include "SkTLS.h"
namespace DM {
@@ -14,14 +14,14 @@ GpuTask::GpuTask(const char* name,
TaskRunner* taskRunner,
const Expectations& expectations,
skiagm::GMRegistry::Factory gmFactory,
- SkBitmap::Config config,
+ SkColorType colorType,
GrContextFactory::GLContextType contextType,
int sampleCount)
: Task(reporter, taskRunner)
, fGM(gmFactory(NULL))
, fName(UnderJoin(fGM->shortName(), name))
, fExpectations(expectations)
- , fConfig(config)
+ , fColorType(colorType)
, fContextType(contextType)
, fSampleCount(sampleCount)
{}
@@ -41,20 +41,19 @@ static GrContextFactory* get_gr_factory() {
void GpuTask::draw() {
GrContext* gr = get_gr_factory()->get(fContextType); // Will be owned by device.
- SkGpuDevice device(gr,
- fConfig,
- SkScalarCeilToInt(fGM->width()),
- SkScalarCeilToInt(fGM->height()),
- fSampleCount);
- SkCanvas canvas(&device);
+ SkImageInfo info = SkImageInfo::Make(SkScalarCeilToInt(fGM->width()),
+ SkScalarCeilToInt(fGM->height()),
+ fColorType, kPremul_SkAlphaType);
+ SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(gr, info, fSampleCount));
+ SkCanvas* canvas = surface->getCanvas();
- canvas.concat(fGM->getInitialTransform());
- fGM->draw(&canvas);
- canvas.flush();
+ canvas->concat(fGM->getInitialTransform());
+ fGM->draw(canvas);
+ canvas->flush();
SkBitmap bitmap;
- bitmap.setConfig(fConfig, SkScalarCeilToInt(fGM->width()), SkScalarCeilToInt(fGM->height()));
- canvas.readPixels(&bitmap, 0, 0);
+ bitmap.setConfig(info);
+ canvas->readPixels(&bitmap, 0, 0);
#if GR_CACHE_STATS
gr->printCacheStats();
« no previous file with comments | « dm/DMGpuTask.h ('k') | dm/DMPipeTask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698