| OLD | NEW |
| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 const SkIRect bounds = m_picture->cullRect().roundOut(); | 172 const SkIRect bounds = m_picture->cullRect().roundOut(); |
| 173 SkBitmap bitmap; | 173 SkBitmap bitmap; |
| 174 bitmap.allocPixels( | 174 bitmap.allocPixels( |
| 175 SkImageInfo::MakeN32Premul(bounds.width(), bounds.height())); | 175 SkImageInfo::MakeN32Premul(bounds.width(), bounds.height())); |
| 176 bitmap.eraseARGB(0, 0, 0, 0); | 176 bitmap.eraseARGB(0, 0, 0, 0); |
| 177 | 177 |
| 178 double now = WTF::monotonicallyIncreasingTime(); | 178 double now = WTF::monotonicallyIncreasingTime(); |
| 179 double stopTime = now + minDuration; | 179 double stopTime = now + minDuration; |
| 180 for (unsigned step = 0; step < minRepeatCount || now < stopTime; ++step) { | 180 for (unsigned step = 0; step < minRepeatCount || now < stopTime; ++step) { |
| 181 timings->append(Vector<double>()); | 181 timings->append(Vector<double>()); |
| 182 Vector<double>* currentTimings = &timings->last(); | 182 Vector<double>* currentTimings = &timings->back(); |
| 183 if (timings->size() > 1) | 183 if (timings->size() > 1) |
| 184 currentTimings->reserveCapacity(timings->begin()->size()); | 184 currentTimings->reserveCapacity(timings->begin()->size()); |
| 185 ProfilingCanvas canvas(bitmap); | 185 ProfilingCanvas canvas(bitmap); |
| 186 if (clipRect) { | 186 if (clipRect) { |
| 187 canvas.clipRect(SkRect::MakeXYWH(clipRect->x(), clipRect->y(), | 187 canvas.clipRect(SkRect::MakeXYWH(clipRect->x(), clipRect->y(), |
| 188 clipRect->width(), clipRect->height())); | 188 clipRect->width(), clipRect->height())); |
| 189 canvas.resetStepCount(); | 189 canvas.resetStepCount(); |
| 190 } | 190 } |
| 191 canvas.setTimings(currentTimings); | 191 canvas.setTimings(currentTimings); |
| 192 m_picture->playback(&canvas); | 192 m_picture->playback(&canvas); |
| 193 now = WTF::monotonicallyIncreasingTime(); | 193 now = WTF::monotonicallyIncreasingTime(); |
| 194 } | 194 } |
| 195 return timings; | 195 return timings; |
| 196 } | 196 } |
| 197 | 197 |
| 198 std::unique_ptr<JSONArray> PictureSnapshot::snapshotCommandLog() const { | 198 std::unique_ptr<JSONArray> PictureSnapshot::snapshotCommandLog() const { |
| 199 const SkIRect bounds = m_picture->cullRect().roundOut(); | 199 const SkIRect bounds = m_picture->cullRect().roundOut(); |
| 200 LoggingCanvas canvas(bounds.width(), bounds.height()); | 200 LoggingCanvas canvas(bounds.width(), bounds.height()); |
| 201 m_picture->playback(&canvas); | 201 m_picture->playback(&canvas); |
| 202 return canvas.log(); | 202 return canvas.log(); |
| 203 } | 203 } |
| 204 | 204 |
| 205 } // namespace blink | 205 } // namespace blink |
| OLD | NEW |