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 11 matching lines...) Expand all Loading... |
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #include "config.h" | 28 #include "config.h" |
29 #include "platform/graphics/Pattern.h" | 29 #include "platform/graphics/Pattern.h" |
30 | 30 |
31 #include "platform/graphics/BitmapPattern.h" | 31 #include "platform/graphics/BitmapPattern.h" |
| 32 #include "platform/graphics/DisplayList.h" |
| 33 #include "platform/graphics/DisplayListPattern.h" |
32 #include "platform/graphics/StaticBitmapPattern.h" | 34 #include "platform/graphics/StaticBitmapPattern.h" |
33 #include "third_party/skia/include/core/SkImage.h" | 35 #include "third_party/skia/include/core/SkImage.h" |
34 #include "third_party/skia/include/core/SkShader.h" | 36 #include "third_party/skia/include/core/SkShader.h" |
35 #include <v8.h> | 37 #include <v8.h> |
36 | 38 |
37 namespace blink { | 39 namespace blink { |
38 | 40 |
39 PassRefPtr<Pattern> Pattern::createBitmapPattern(PassRefPtr<Image> tileImage, Re
peatMode repeatMode) | 41 PassRefPtr<Pattern> Pattern::createBitmapPattern(PassRefPtr<Image> tileImage, Re
peatMode repeatMode) |
40 { | 42 { |
41 if (tileImage->skImage()) | 43 if (tileImage->skImage()) |
42 return StaticBitmapPattern::create(tileImage, repeatMode); | 44 return StaticBitmapPattern::create(tileImage, repeatMode); |
43 | 45 |
44 return BitmapPattern::create(tileImage, repeatMode); | 46 return BitmapPattern::create(tileImage, repeatMode); |
45 } | 47 } |
46 | 48 |
| 49 PassRefPtr<Pattern> Pattern::createDisplayListPattern(PassRefPtr<DisplayList> di
splayList, |
| 50 RepeatMode repeatMode) |
| 51 { |
| 52 return DisplayListPattern::create(displayList, repeatMode); |
| 53 } |
| 54 |
47 Pattern::Pattern(RepeatMode repeatMode, int64_t externalMemoryAllocated) | 55 Pattern::Pattern(RepeatMode repeatMode, int64_t externalMemoryAllocated) |
48 : m_repeatMode(repeatMode) | 56 : m_repeatMode(repeatMode) |
49 , m_externalMemoryAllocated(0) | 57 , m_externalMemoryAllocated(0) |
50 { | 58 { |
51 adjustExternalMemoryAllocated(externalMemoryAllocated); | 59 adjustExternalMemoryAllocated(externalMemoryAllocated); |
52 } | 60 } |
53 | 61 |
54 Pattern::~Pattern() | 62 Pattern::~Pattern() |
55 { | 63 { |
56 adjustExternalMemoryAllocated(-m_externalMemoryAllocated); | 64 adjustExternalMemoryAllocated(-m_externalMemoryAllocated); |
(...skipping 20 matching lines...) Expand all Loading... |
77 void Pattern::adjustExternalMemoryAllocated(int64_t delta) | 85 void Pattern::adjustExternalMemoryAllocated(int64_t delta) |
78 { | 86 { |
79 delta = std::max(-m_externalMemoryAllocated, delta); | 87 delta = std::max(-m_externalMemoryAllocated, delta); |
80 | 88 |
81 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(delta); | 89 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(delta); |
82 | 90 |
83 m_externalMemoryAllocated += delta; | 91 m_externalMemoryAllocated += delta; |
84 } | 92 } |
85 | 93 |
86 } // namespace blink | 94 } // namespace blink |
OLD | NEW |