Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Bitmap_getAddr16.cpp
Go to the documentation of this file.
1// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4// HASH=53e00899ef2e00e2096daf7a07d9b059
5REG_FIDDLE(Bitmap_getAddr16, 256, 256, true, 3) {
6void draw(SkCanvas* canvas) {
7 SkBitmap bitmap16;
10 bitmap16.allocPixels(dstInfo);
11 if (source.readPixels(dstInfo, bitmap16.getPixels(), bitmap16.rowBytes(), 0, 0)) {
12 uint16_t* row0 = bitmap16.getAddr16(0, 0);
13 uint16_t* row1 = bitmap16.getAddr16(0, 1);
14 size_t interval = (row1 - row0) * bitmap16.bytesPerPixel();
15 SkDebugf("addr interval %c= rowBytes\n", interval == bitmap16.rowBytes() ? '=' : '!');
16 }
17}
18} // END FIDDLE
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition SkAlphaType.h:29
@ kARGB_4444_SkColorType
pixel with 4 bits for alpha, red, green, blue; in 16-bit word
Definition SkColorType.h:23
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void allocPixels(const SkImageInfo &info, size_t rowBytes)
Definition SkBitmap.cpp:258
int width() const
Definition SkBitmap.h:149
size_t rowBytes() const
Definition SkBitmap.h:238
void * getPixels() const
Definition SkBitmap.h:283
int bytesPerPixel() const
Definition SkBitmap.h:187
bool readPixels(const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY) const
Definition SkBitmap.cpp:488
int height() const
Definition SkBitmap.h:158
uint16_t * getAddr16(int x, int y) const
Definition SkBitmap.h:1265
SkBitmap source
Definition examples.cpp:28
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)