本文整理汇总了C++中SkAutoTUnref::height方法的典型用法代码示例。如果您正苦于以下问题:C++ SkAutoTUnref::height方法的具体用法?C++ SkAutoTUnref::height怎么用?C++ SkAutoTUnref::height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkAutoTUnref
的用法示例。
在下文中一共展示了SkAutoTUnref::height方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawHere
void drawHere(SkCanvas* canvas, SkFilterQuality filter, SkScalar dx, SkScalar dy) {
SkCanvas* origCanvas = canvas;
SkAutoCanvasRestore acr(canvas, true);
SkISize size = SkISize::Make(fImage->width(), fImage->height());
SkAutoTUnref<SkSurface> surface;
if (fShowFatBits) {
// scale up so we don't clip rotations
SkImageInfo info = SkImageInfo::MakeN32(fImage->width() * 2, fImage->height() * 2,
kOpaque_SkAlphaType);
surface.reset(make_surface(canvas, info));
canvas = surface->getCanvas();
canvas->drawColor(SK_ColorWHITE);
size.set(info.width(), info.height());
} else {
canvas->translate(SkScalarHalf(fCell.width() - fImage->width()),
SkScalarHalf(fCell.height() - fImage->height()));
}
this->drawTheImage(canvas, size, filter, dx, dy);
if (surface) {
SkAutoTUnref<SkImage> orig(surface->newImageSnapshot());
SkAutoTUnref<SkImage> zoomed(zoom_up(orig));
origCanvas->drawImage(zoomed,
SkScalarHalf(fCell.width() - zoomed->width()),
SkScalarHalf(fCell.height() - zoomed->height()));
}
}
示例2: drawTheImage
void drawTheImage(SkCanvas* canvas, const SkISize& size, SkFilterQuality filter,
SkScalar dx, SkScalar dy) {
SkPaint paint;
paint.setAntiAlias(true);
paint.setFilterQuality(filter);
SkAutoCanvasRestore acr(canvas, true);
canvas->translate(dx, dy);
canvas->translate(SkScalarHalf(size.width()), SkScalarHalf(size.height()));
canvas->scale(fScale, fScale);
canvas->rotate(fAngle);
canvas->drawImage(fImage, -SkScalarHalf(fImage->width()), -SkScalarHalf(fImage->height()),
&paint);
if (false) {
acr.restore();
draw_box_frame(canvas, size.width(), size.height());
}
}
示例3: main
int main(void) {
GLFWwindow* window;
glfwSetErrorCallback(error_callback);
if (!glfwInit()) {
exit(EXIT_FAILURE);
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_SRGB_CAPABLE, GL_TRUE);
window = glfwCreateWindow(kWidth, kHeight, "Simple example", NULL, NULL);
if (!window) {
glfwTerminate();
exit(EXIT_FAILURE);
}
glfwMakeContextCurrent(window);
init_skia(kWidth, kHeight);
SkAutoTUnref<SkImage> atlas;
SkRSXform xform[kGrid*kGrid+1];
SkRect tex[kGrid*kGrid+1];
WallTimer timer;
float times[32];
int currentTime;
SkAutoTUnref<SkData> imageData(SkData::NewFromFileName("ship.png"));
atlas.reset(SkImage::NewFromEncoded(imageData));
if (!atlas) {
SkDebugf("\nCould not decode file ship.png\n");
cleanup_skia();
glfwDestroyWindow(window);
glfwTerminate();
exit(EXIT_FAILURE);
}
SkScalar anchorX = atlas->width()*0.5f;
SkScalar anchorY = atlas->height()*0.5f;
int currIndex = 0;
for (int x = 0; x < kGrid; x++) {
for (int y = 0; y < kGrid; y++) {
float xPos = (x / (kGrid - 1.0)) * kWidth;
float yPos = (y / (kGrid - 1.0)) * kWidth;
tex[currIndex] = SkRect::MakeLTRB(0.0f, 0.0f, atlas->width(), atlas->height());
xform[currIndex] = SkRSXform::MakeFromRadians(2.0f, SK_ScalarPI*0.5f,
xPos, yPos, anchorX, anchorY);
currIndex++;
}
}
tex[currIndex] = SkRect::MakeLTRB(0.0f, 0.0f, atlas->width(), atlas->height());
xform[currIndex] = SkRSXform::MakeFromRadians(2.0f, SK_ScalarPI*0.5f,
kWidth*0.5f, kHeight*0.5f, anchorX, anchorY);
currentTime = 0;
glfwSwapInterval(1);
glfwSetKeyCallback(window, key_callback);
// Draw to the surface via its SkCanvas.
SkCanvas* canvas = sSurface->getCanvas(); // We don't manage this pointer's lifetime.
SkPaint paint;
paint.setFilterQuality(kLow_SkFilterQuality);
paint.setColor(SK_ColorWHITE);
paint.setTextSize(15.0f);
while (!glfwWindowShouldClose(window)) {
const float kCosDiff = 0.99984769515f;
const float kSinDiff = 0.01745240643f;
timer.start();
glfwPollEvents();
float meanTime = 0.0f;
for (int i = 0; i < 32; ++i) {
meanTime += times[i];
}
meanTime /= 32.f;
char outString[64];
float fps = 1000.f/meanTime;
sprintf(outString, "fps: %f ms: %f", fps, meanTime);
for (int i = 0; i < kGrid*kGrid+1; ++i) {
SkScalar c = xform[i].fSCos;
SkScalar s = xform[i].fSSin;
SkScalar dx = c*anchorX - s*anchorY;
SkScalar dy = s*anchorX + c*anchorY;
xform[i].fSCos = kCosDiff*c - kSinDiff*s;
xform[i].fSSin = kSinDiff*c + kCosDiff*s;
dx -= xform[i].fSCos*anchorX - xform[i].fSSin*anchorY;
dy -= xform[i].fSSin*anchorX + xform[i].fSCos*anchorY;
xform[i].fTx += dx;
//.........这里部分代码省略.........