OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved. |
3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
4 * Copyright (C) 2013 Google, Inc. All rights reserved. | 4 * Copyright (C) 2013 Google, Inc. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "third_party/skia/include/core/SkImage.h" | 35 #include "third_party/skia/include/core/SkImage.h" |
36 #include "third_party/skia/include/core/SkShader.h" | 36 #include "third_party/skia/include/core/SkShader.h" |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 PassRefPtr<Pattern> Pattern::CreateImagePattern(PassRefPtr<Image> tile_image, | 40 PassRefPtr<Pattern> Pattern::CreateImagePattern(PassRefPtr<Image> tile_image, |
41 RepeatMode repeat_mode) { | 41 RepeatMode repeat_mode) { |
42 return ImagePattern::Create(std::move(tile_image), repeat_mode); | 42 return ImagePattern::Create(std::move(tile_image), repeat_mode); |
43 } | 43 } |
44 | 44 |
45 PassRefPtr<Pattern> Pattern::CreatePaintRecordPattern(sk_sp<PaintRecord> record, | 45 PassRefPtr<Pattern> Pattern::CreatePaintRecordPattern( |
46 RepeatMode repeat_mode) { | 46 sk_sp<PaintRecord> record, |
47 return PaintRecordPattern::Create(std::move(record), repeat_mode); | 47 const FloatRect& record_bounds, |
| 48 RepeatMode repeat_mode) { |
| 49 return PaintRecordPattern::Create(std::move(record), record_bounds, |
| 50 repeat_mode); |
48 } | 51 } |
49 | 52 |
50 Pattern::Pattern(RepeatMode repeat_mode) : repeat_mode_(repeat_mode) {} | 53 Pattern::Pattern(RepeatMode repeat_mode) : repeat_mode_(repeat_mode) {} |
51 | 54 |
52 Pattern::~Pattern() { | 55 Pattern::~Pattern() { |
53 } | 56 } |
54 | 57 |
55 void Pattern::ApplyToFlags(PaintFlags& flags, const SkMatrix& local_matrix) { | 58 void Pattern::ApplyToFlags(PaintFlags& flags, const SkMatrix& local_matrix) { |
56 if (!cached_shader_ || IsLocalMatrixChanged(local_matrix)) | 59 if (!cached_shader_ || IsLocalMatrixChanged(local_matrix)) |
57 cached_shader_ = CreateShader(local_matrix); | 60 cached_shader_ = CreateShader(local_matrix); |
58 | 61 |
59 flags.setShader(cached_shader_); | 62 flags.setShader(cached_shader_); |
60 } | 63 } |
61 | 64 |
62 bool Pattern::IsLocalMatrixChanged(const SkMatrix& local_matrix) const { | 65 bool Pattern::IsLocalMatrixChanged(const SkMatrix& local_matrix) const { |
63 return local_matrix != cached_shader_->getLocalMatrix(); | 66 return local_matrix != cached_shader_->getLocalMatrix(); |
64 } | 67 } |
65 | 68 |
66 } // namespace blink | 69 } // namespace blink |
OLD | NEW |