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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp

Issue 2398453002: Rewrap comments to 80 columns in Source/platform/graphics/. (Closed)
Patch Set: Review feedback Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 bool PictureSnapshot::isEmpty() const { 116 bool PictureSnapshot::isEmpty() const {
117 return m_picture->cullRect().isEmpty(); 117 return m_picture->cullRect().isEmpty();
118 } 118 }
119 119
120 std::unique_ptr<Vector<char>> PictureSnapshot::replay(unsigned fromStep, 120 std::unique_ptr<Vector<char>> PictureSnapshot::replay(unsigned fromStep,
121 unsigned toStep, 121 unsigned toStep,
122 double scale) const { 122 double scale) const {
123 const SkIRect bounds = m_picture->cullRect().roundOut(); 123 const SkIRect bounds = m_picture->cullRect().roundOut();
124 124
125 // TODO(fmalita): convert this to SkSurface/SkImage, drop the intermediate SkB itmap. 125 // TODO(fmalita): convert this to SkSurface/SkImage, drop the intermediate
126 // SkBitmap.
126 SkBitmap bitmap; 127 SkBitmap bitmap;
127 bitmap.allocPixels( 128 bitmap.allocPixels(
128 SkImageInfo::MakeN32Premul(bounds.width(), bounds.height())); 129 SkImageInfo::MakeN32Premul(bounds.width(), bounds.height()));
129 bitmap.eraseARGB(0, 0, 0, 0); 130 bitmap.eraseARGB(0, 0, 0, 0);
130 { 131 {
131 ReplayingCanvas canvas(bitmap, fromStep, toStep); 132 ReplayingCanvas canvas(bitmap, fromStep, toStep);
132 // Disable LCD text preemptively, because the picture opacity is unknown. 133 // Disable LCD text preemptively, because the picture opacity is unknown.
133 // The canonical API involves SkSurface props, but since we're not SkSurface -based 134 // The canonical API involves SkSurface props, but since we're not
134 // at this point (see TODO above) we (ab)use saveLayer for this purpose. 135 // SkSurface-based at this point (see TODO above) we (ab)use saveLayer for
136 // this purpose.
135 SkAutoCanvasRestore autoRestore(&canvas, false); 137 SkAutoCanvasRestore autoRestore(&canvas, false);
136 canvas.saveLayer(nullptr, nullptr); 138 canvas.saveLayer(nullptr, nullptr);
137 139
138 canvas.scale(scale, scale); 140 canvas.scale(scale, scale);
139 canvas.resetStepCount(); 141 canvas.resetStepCount();
140 m_picture->playback(&canvas, &canvas); 142 m_picture->playback(&canvas, &canvas);
141 } 143 }
142 std::unique_ptr<Vector<char>> base64Data = wrapUnique(new Vector<char>()); 144 std::unique_ptr<Vector<char>> base64Data = wrapUnique(new Vector<char>());
143 Vector<char> encodedImage; 145 Vector<char> encodedImage;
144 146
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 } 195 }
194 196
195 std::unique_ptr<JSONArray> PictureSnapshot::snapshotCommandLog() const { 197 std::unique_ptr<JSONArray> PictureSnapshot::snapshotCommandLog() const {
196 const SkIRect bounds = m_picture->cullRect().roundOut(); 198 const SkIRect bounds = m_picture->cullRect().roundOut();
197 LoggingCanvas canvas(bounds.width(), bounds.height()); 199 LoggingCanvas canvas(bounds.width(), bounds.height());
198 m_picture->playback(&canvas); 200 m_picture->playback(&canvas);
199 return canvas.log(); 201 return canvas.log();
200 } 202 }
201 203
202 } // namespace blink 204 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698