OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/paint/record_paint_canvas.h" | 5 #include "cc/paint/record_paint_canvas.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "cc/paint/display_item_list.h" | 8 #include "cc/paint/display_item_list.h" |
9 #include "cc/paint/paint_op_buffer.h" | 9 #include "cc/paint/paint_op_buffer.h" |
10 #include "cc/paint/paint_record.h" | 10 #include "cc/paint/paint_record.h" |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 buffer_->push<DrawImageRectOp>(image, src, dst, flags, constraint); | 279 buffer_->push<DrawImageRectOp>(image, src, dst, flags, constraint); |
280 } | 280 } |
281 | 281 |
282 void RecordPaintCanvas::drawBitmap(const SkBitmap& bitmap, | 282 void RecordPaintCanvas::drawBitmap(const SkBitmap& bitmap, |
283 SkScalar left, | 283 SkScalar left, |
284 SkScalar top, | 284 SkScalar top, |
285 const PaintFlags* flags) { | 285 const PaintFlags* flags) { |
286 // TODO(enne): Move into base class? | 286 // TODO(enne): Move into base class? |
287 if (bitmap.drawsNothing()) | 287 if (bitmap.drawsNothing()) |
288 return; | 288 return; |
289 drawImage(PaintImage(SkImage::MakeFromBitmap(bitmap), | 289 drawImage( |
290 PaintImage::AnimationType::UNKNOWN, | 290 PaintImage(PaintImage::kNonLazyStableId, SkImage::MakeFromBitmap(bitmap), |
291 PaintImage::CompletionState::UNKNOWN), | 291 PaintImage::AnimationType::UNKNOWN, |
292 left, top, flags); | 292 PaintImage::CompletionState::UNKNOWN), |
| 293 left, top, flags); |
293 } | 294 } |
294 | 295 |
295 void RecordPaintCanvas::drawText(const void* text, | 296 void RecordPaintCanvas::drawText(const void* text, |
296 size_t byte_length, | 297 size_t byte_length, |
297 SkScalar x, | 298 SkScalar x, |
298 SkScalar y, | 299 SkScalar y, |
299 const PaintFlags& flags) { | 300 const PaintFlags& flags) { |
300 buffer_->push_with_data<DrawTextOp>(text, byte_length, x, y, flags); | 301 buffer_->push_with_data<DrawTextOp>(text, byte_length, x, y, flags); |
301 } | 302 } |
302 | 303 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 // By creating a canvas of size (right x bottom) and then clipping it, | 363 // By creating a canvas of size (right x bottom) and then clipping it, |
363 // It makes getDeviceClipBounds return the original cull rect, which code | 364 // It makes getDeviceClipBounds return the original cull rect, which code |
364 // in GraphicsContextCanvas on Mac expects. (Just creating an SkNoDrawCanvas | 365 // in GraphicsContextCanvas on Mac expects. (Just creating an SkNoDrawCanvas |
365 // with the cull_rect makes a canvas of size (width x height) instead | 366 // with the cull_rect makes a canvas of size (width x height) instead |
366 // which is incorrect. SkRecorder cheats with private resetForNextCanvas. | 367 // which is incorrect. SkRecorder cheats with private resetForNextCanvas. |
367 canvas_->clipRect(recording_bounds, SkClipOp::kIntersect, false); | 368 canvas_->clipRect(recording_bounds, SkClipOp::kIntersect, false); |
368 return &*canvas_; | 369 return &*canvas_; |
369 } | 370 } |
370 | 371 |
371 } // namespace cc | 372 } // namespace cc |
OLD | NEW |