Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(745)

Side by Side Diff: Source/WebKit/chromium/tests/DragImageTest.cpp

Issue 15969015: Reland again "Decode GIF image frames on demand". (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: For landing Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 explicit TestImage(const IntSize& size) 52 explicit TestImage(const IntSize& size)
53 : Image(0) 53 : Image(0)
54 , m_size(size) 54 , m_size(size)
55 { 55 {
56 m_nativeImage = NativeImageSkia::create(); 56 m_nativeImage = NativeImageSkia::create();
57 m_nativeImage->bitmap().setConfig(SkBitmap::kARGB_8888_Config, 57 m_nativeImage->bitmap().setConfig(SkBitmap::kARGB_8888_Config,
58 size.width(), size.height(), 0); 58 size.width(), size.height(), 0);
59 m_nativeImage->bitmap().allocPixels(); 59 m_nativeImage->bitmap().allocPixels();
60 } 60 }
61 61
62 virtual IntSize size() const 62 virtual IntSize size() const OVERRIDE
63 { 63 {
64 return m_size; 64 return m_size;
65 } 65 }
66 66
67 virtual PassRefPtr<NativeImageSkia> nativeImageForCurrentFrame() 67 virtual PassRefPtr<NativeImageSkia> nativeImageForCurrentFrame() OVERRIDE
68 { 68 {
69 if (m_size.isZero()) 69 if (m_size.isZero())
70 return 0; 70 return 0;
71 71
72 return m_nativeImage; 72 return m_nativeImage;
73 } 73 }
74 74
75 // Stub implementations of pure virtual Image functions. 75 // Stub implementations of pure virtual Image functions.
76 virtual void destroyDecodedData(bool) 76 virtual void destroyDecodedData() OVERRIDE
77 { 77 {
78 } 78 }
79 79
80 virtual unsigned decodedSize() const 80 virtual unsigned decodedSize() const OVERRIDE
81 { 81 {
82 return 0u; 82 return 0u;
83 } 83 }
84 84
85 virtual bool currentFrameKnownToBeOpaque() 85 virtual bool currentFrameKnownToBeOpaque() OVERRIDE
86 { 86 {
87 return false; 87 return false;
88 } 88 }
89 89
90 virtual void draw(WebCore::GraphicsContext*, const WebCore::FloatRect&, 90 virtual void draw(GraphicsContext*, const FloatRect&, const FloatRect&, Colo rSpace, CompositeOperator, BlendMode) OVERRIDE
91 const WebCore::FloatRect&, WebCore::ColorSpace,
92 WebCore::CompositeOperator, WebCore::BlendMode)
93 { 91 {
94 } 92 }
95 93
96 private: 94 private:
97 95
98 IntSize m_size; 96 IntSize m_size;
99 97
100 RefPtr<NativeImageSkia> m_nativeImage; 98 RefPtr<NativeImageSkia> m_nativeImage;
101 }; 99 };
102 100
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // Tests that the drag image is a deep copy. 141 // Tests that the drag image is a deep copy.
144 RefPtr<TestImage> testImage(TestImage::create(IntSize(1, 1))); 142 RefPtr<TestImage> testImage(TestImage::create(IntSize(1, 1)));
145 DragImageRef dragImage = createDragImageFromImage(testImage.get()); 143 DragImageRef dragImage = createDragImageFromImage(testImage.get());
146 ASSERT_TRUE(dragImage); 144 ASSERT_TRUE(dragImage);
147 SkAutoLockPixels lock1(*dragImage->bitmap), lock2(testImage->nativeImage ForCurrentFrame()->bitmap()); 145 SkAutoLockPixels lock1(*dragImage->bitmap), lock2(testImage->nativeImage ForCurrentFrame()->bitmap());
148 EXPECT_NE(dragImage->bitmap->getPixels(), testImage->nativeImageForCurre ntFrame()->bitmap().getPixels()); 146 EXPECT_NE(dragImage->bitmap->getPixels(), testImage->nativeImageForCurre ntFrame()->bitmap().getPixels());
149 } 147 }
150 } 148 }
151 149
152 } // anonymous namespace 150 } // anonymous namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698