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

Side by Side Diff: Source/platform/image-decoders/ImageFrame.cpp

Issue 1001703003: Take NativeImageSkia out behind the woodshed. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Switch to skia-style API (return bool instead of SkBitmap) Created 5 years, 9 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
« no previous file with comments | « Source/platform/image-decoders/ImageFrame.h ('k') | Source/web/DragClientImpl.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2008, 2009 Google, Inc. 3 * Copyright (C) 2008, 2009 Google, Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 ASSERT(!width() && !height()); 107 ASSERT(!width() && !height());
108 108
109 m_bitmap.setInfo(SkImageInfo::MakeN32Premul(newWidth, newHeight)); 109 m_bitmap.setInfo(SkImageInfo::MakeN32Premul(newWidth, newHeight));
110 if (!m_bitmap.tryAllocPixels(m_allocator, 0)) 110 if (!m_bitmap.tryAllocPixels(m_allocator, 0))
111 return false; 111 return false;
112 112
113 zeroFillPixelData(); 113 zeroFillPixelData();
114 return true; 114 return true;
115 } 115 }
116 116
117 PassRefPtr<NativeImageSkia> ImageFrame::asNewNativeImage() const 117 const SkBitmap& ImageFrame::bitmap() const
118 { 118 {
119 return NativeImageSkia::create(m_bitmap); 119 return m_bitmap;
120 } 120 }
121 121
122 bool ImageFrame::hasAlpha() const 122 bool ImageFrame::hasAlpha() const
123 { 123 {
124 return m_hasAlpha; 124 return m_hasAlpha;
125 } 125 }
126 126
127 void ImageFrame::setHasAlpha(bool alpha) 127 void ImageFrame::setHasAlpha(bool alpha)
128 { 128 {
129 m_hasAlpha = alpha; 129 m_hasAlpha = alpha;
(...skipping 21 matching lines...) Expand all
151 void ImageFrame::zeroFillFrameRect(const IntRect& rect) 151 void ImageFrame::zeroFillFrameRect(const IntRect& rect)
152 { 152 {
153 if (rect.isEmpty()) 153 if (rect.isEmpty())
154 return; 154 return;
155 155
156 m_bitmap.eraseArea(rect, SkColorSetARGB(0, 0, 0, 0)); 156 m_bitmap.eraseArea(rect, SkColorSetARGB(0, 0, 0, 0));
157 setHasAlpha(true); 157 setHasAlpha(true);
158 } 158 }
159 159
160 } // namespace blink 160 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/image-decoders/ImageFrame.h ('k') | Source/web/DragClientImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698