| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/gfx/ipc/gfx_param_traits.h" | 5 #include "ui/gfx/ipc/gfx_param_traits.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "third_party/skia/include/core/SkBitmap.h" | 9 #include "third_party/skia/include/core/SkBitmap.h" |
| 10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 SkAlphaType fAlphaType; | 21 SkAlphaType fAlphaType; |
| 22 | 22 |
| 23 // The width of the bitmap in pixels. | 23 // The width of the bitmap in pixels. |
| 24 uint32 fWidth; | 24 uint32 fWidth; |
| 25 | 25 |
| 26 // The height of the bitmap in pixels. | 26 // The height of the bitmap in pixels. |
| 27 uint32 fHeight; | 27 uint32 fHeight; |
| 28 | 28 |
| 29 void InitSkBitmapDataForTransfer(const SkBitmap& bitmap) { | 29 void InitSkBitmapDataForTransfer(const SkBitmap& bitmap) { |
| 30 const SkImageInfo& info = bitmap.info(); | 30 const SkImageInfo& info = bitmap.info(); |
| 31 fColorType = info.fColorType; | 31 fColorType = info.colorType(); |
| 32 fAlphaType = info.fAlphaType; | 32 fAlphaType = info.alphaType(); |
| 33 fWidth = info.fWidth; | 33 fWidth = info.width(); |
| 34 fHeight = info.fHeight; | 34 fHeight = info.height(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 // Returns whether |bitmap| successfully initialized. | 37 // Returns whether |bitmap| successfully initialized. |
| 38 bool InitSkBitmapFromData(SkBitmap* bitmap, | 38 bool InitSkBitmapFromData(SkBitmap* bitmap, |
| 39 const char* pixels, | 39 const char* pixels, |
| 40 size_t pixels_size) const { | 40 size_t pixels_size) const { |
| 41 if (!bitmap->tryAllocPixels( | 41 if (!bitmap->tryAllocPixels( |
| 42 SkImageInfo::Make(fWidth, fHeight, fColorType, fAlphaType))) | 42 SkImageInfo::Make(fWidth, fHeight, fColorType, fAlphaType))) |
| 43 return false; | 43 return false; |
| 44 if (pixels_size != bitmap->getSize()) | 44 if (pixels_size != bitmap->getSize()) |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 r->set_end(end); | 281 r->set_end(end); |
| 282 return true; | 282 return true; |
| 283 } | 283 } |
| 284 | 284 |
| 285 void ParamTraits<gfx::Range>::Log(const gfx::Range& r, std::string* l) { | 285 void ParamTraits<gfx::Range>::Log(const gfx::Range& r, std::string* l) { |
| 286 l->append(base::StringPrintf("(%" PRIuS ", %" PRIuS ")", r.start(), r.end())); | 286 l->append(base::StringPrintf("(%" PRIuS ", %" PRIuS ")", r.start(), r.end())); |
| 287 } | 287 } |
| 288 | 288 |
| 289 | 289 |
| 290 } // namespace IPC | 290 } // namespace IPC |
| OLD | NEW |