| 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( | 289 drawImage(PaintImage(SkImage::MakeFromBitmap(bitmap), |
| 290 PaintImage(PaintImage::kNonLazyStableId, SkImage::MakeFromBitmap(bitmap), | 290 PaintImage::AnimationType::UNKNOWN, |
| 291 PaintImage::AnimationType::UNKNOWN, | 291 PaintImage::CompletionState::UNKNOWN), |
| 292 PaintImage::CompletionState::UNKNOWN), | 292 left, top, flags); |
| 293 left, top, flags); | |
| 294 } | 293 } |
| 295 | 294 |
| 296 void RecordPaintCanvas::drawText(const void* text, | 295 void RecordPaintCanvas::drawText(const void* text, |
| 297 size_t byte_length, | 296 size_t byte_length, |
| 298 SkScalar x, | 297 SkScalar x, |
| 299 SkScalar y, | 298 SkScalar y, |
| 300 const PaintFlags& flags) { | 299 const PaintFlags& flags) { |
| 301 buffer_->push_with_data<DrawTextOp>(text, byte_length, x, y, flags); | 300 buffer_->push_with_data<DrawTextOp>(text, byte_length, x, y, flags); |
| 302 } | 301 } |
| 303 | 302 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 // By creating a canvas of size (right x bottom) and then clipping it, | 362 // By creating a canvas of size (right x bottom) and then clipping it, |
| 364 // It makes getDeviceClipBounds return the original cull rect, which code | 363 // It makes getDeviceClipBounds return the original cull rect, which code |
| 365 // in GraphicsContextCanvas on Mac expects. (Just creating an SkNoDrawCanvas | 364 // in GraphicsContextCanvas on Mac expects. (Just creating an SkNoDrawCanvas |
| 366 // with the cull_rect makes a canvas of size (width x height) instead | 365 // with the cull_rect makes a canvas of size (width x height) instead |
| 367 // which is incorrect. SkRecorder cheats with private resetForNextCanvas. | 366 // which is incorrect. SkRecorder cheats with private resetForNextCanvas. |
| 368 canvas_->clipRect(SkRect::Make(rect), SkClipOp::kIntersect, false); | 367 canvas_->clipRect(SkRect::Make(rect), SkClipOp::kIntersect, false); |
| 369 return &*canvas_; | 368 return &*canvas_; |
| 370 } | 369 } |
| 371 | 370 |
| 372 } // namespace cc | 371 } // namespace cc |
| OLD | NEW |