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

Unified Diff: sky/engine/platform/graphics/GraphicsContextRecorder.cpp

Issue 812543002: Update from https://crrev.com/308331 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
Index: sky/engine/platform/graphics/GraphicsContextRecorder.cpp
diff --git a/sky/engine/platform/graphics/GraphicsContextRecorder.cpp b/sky/engine/platform/graphics/GraphicsContextRecorder.cpp
index 6b8851b39179c0fe2f73d09b050131b496308edb..05d82f6f6b57007e5b6db98c1ef479b2730c8ee7 100644
--- a/sky/engine/platform/graphics/GraphicsContextRecorder.cpp
+++ b/sky/engine/platform/graphics/GraphicsContextRecorder.cpp
@@ -100,10 +100,9 @@ PassRefPtr<GraphicsContextSnapshot> GraphicsContextSnapshot::load(const char* da
PassOwnPtr<Vector<char> > GraphicsContextSnapshot::replay(unsigned fromStep, unsigned toStep, double scale) const
{
- int width = ceil(scale * m_picture->width());
- int height = ceil(scale * m_picture->height());
+ const SkIRect bounds = m_picture->cullRect().roundOut();
SkBitmap bitmap;
- bitmap.allocPixels(SkImageInfo::MakeN32Premul(width, height));
+ bitmap.allocPixels(SkImageInfo::MakeN32Premul(bounds.width(), bounds.height()));
{
ReplayingCanvas canvas(bitmap, fromStep, toStep);
canvas.scale(scale, scale);
@@ -122,8 +121,9 @@ PassOwnPtr<GraphicsContextSnapshot::Timings> GraphicsContextSnapshot::profile(un
{
OwnPtr<GraphicsContextSnapshot::Timings> timings = adoptPtr(new GraphicsContextSnapshot::Timings());
timings->reserveCapacity(minRepeatCount);
+ const SkIRect bounds = m_picture->cullRect().roundOut();
SkBitmap bitmap;
- bitmap.allocPixels(SkImageInfo::MakeN32Premul(m_picture->width(), m_picture->height()));
+ bitmap.allocPixels(SkImageInfo::MakeN32Premul(bounds.width(), bounds.height()));
OwnPtr<ProfilingCanvas> canvas = adoptPtr(new ProfilingCanvas(bitmap));
double now = WTF::monotonicallyIncreasingTime();
@@ -144,7 +144,8 @@ PassOwnPtr<GraphicsContextSnapshot::Timings> GraphicsContextSnapshot::profile(un
PassRefPtr<JSONArray> GraphicsContextSnapshot::snapshotCommandLog() const
{
- LoggingCanvas canvas(m_picture->width(), m_picture->height());
+ const SkIRect bounds = m_picture->cullRect().roundOut();
+ LoggingCanvas canvas(bounds.width(), bounds.height());
m_picture->draw(&canvas);
return canvas.log();
}
« no previous file with comments | « sky/engine/platform/graphics/GraphicsContextCullSaver.h ('k') | sky/engine/platform/graphics/InterceptingCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698