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 10 matching lines...) Expand all Loading... |
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
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/ImagePattern.h" |
32 #include "platform/graphics/PicturePattern.h" | 32 #include "platform/graphics/PicturePattern.h" |
33 #include "platform/graphics/StaticBitmapPattern.h" | |
34 #include "third_party/skia/include/core/SkImage.h" | 33 #include "third_party/skia/include/core/SkImage.h" |
35 #include "third_party/skia/include/core/SkPicture.h" | 34 #include "third_party/skia/include/core/SkPicture.h" |
36 #include "third_party/skia/include/core/SkShader.h" | 35 #include "third_party/skia/include/core/SkShader.h" |
37 #include <v8.h> | 36 #include <v8.h> |
38 | 37 |
39 namespace blink { | 38 namespace blink { |
40 | 39 |
41 PassRefPtr<Pattern> Pattern::createBitmapPattern(PassRefPtr<Image> tileImage, Re
peatMode repeatMode) | 40 PassRefPtr<Pattern> Pattern::createImagePattern(PassRefPtr<Image> tileImage, Rep
eatMode repeatMode) |
42 { | 41 { |
43 // TODO(fmalita): do we still need BitmapPattern at all? | 42 return ImagePattern::create(tileImage, repeatMode); |
44 if (tileImage->isBitmapImage()) | |
45 return BitmapPattern::create(tileImage, repeatMode); | |
46 | |
47 return StaticBitmapPattern::create(tileImage, repeatMode); | |
48 } | 43 } |
49 | 44 |
50 PassRefPtr<Pattern> Pattern::createPicturePattern(PassRefPtr<const SkPicture> pi
cture, | 45 PassRefPtr<Pattern> Pattern::createPicturePattern(PassRefPtr<const SkPicture> pi
cture, |
51 RepeatMode repeatMode) | 46 RepeatMode repeatMode) |
52 { | 47 { |
53 return PicturePattern::create(picture, repeatMode); | 48 return PicturePattern::create(picture, repeatMode); |
54 } | 49 } |
55 | 50 |
56 Pattern::Pattern(RepeatMode repeatMode, int64_t externalMemoryAllocated) | 51 Pattern::Pattern(RepeatMode repeatMode, int64_t externalMemoryAllocated) |
57 : m_repeatMode(repeatMode) | 52 : m_repeatMode(repeatMode) |
(...skipping 28 matching lines...) Expand all Loading... |
86 void Pattern::adjustExternalMemoryAllocated(int64_t delta) | 81 void Pattern::adjustExternalMemoryAllocated(int64_t delta) |
87 { | 82 { |
88 delta = std::max(-m_externalMemoryAllocated, delta); | 83 delta = std::max(-m_externalMemoryAllocated, delta); |
89 | 84 |
90 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(delta); | 85 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(delta); |
91 | 86 |
92 m_externalMemoryAllocated += delta; | 87 m_externalMemoryAllocated += delta; |
93 } | 88 } |
94 | 89 |
95 } // namespace blink | 90 } // namespace blink |
OLD | NEW |