blob: aed07cc7a9d7e6601152423b1cd724566b7fb706 [file] [log] [blame]
Leon Scroggins III2e0fadb2018-01-16 21:10:29 -05001/*
2 * Copyright 2018 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "gm.h"
9
10#include "SkCanvas.h"
11#include "SkColor.h"
12#include "SkImage.h"
13#include "Resources.h"
14
15// This gm draws 8 images that are mostly the same when respecting the
16// EXIF orientation tag. Each one has four quadrants (red, blue, green,
17// yellow), and labels on the left, top, right and bottom. The only
18// visual difference is a number in the middle corresponding to the
19// EXIF tag for that image's jpg file.
20DEF_SIMPLE_GM(orientation, canvas, 400, 320) {
21 canvas->save();
22 for (char i = '1'; i <= '8'; i++) {
23 SkString path = SkStringPrintf("images/orientation/%c.jpg", i);
24 auto image = GetResourceAsImage(path.c_str());
Hal Canarybaa2a282018-11-26 15:34:12 -050025 if (!image) {
26 continue;
27 }
Leon Scroggins III2e0fadb2018-01-16 21:10:29 -050028 canvas->drawImage(image, 0, 0);
29 if ('4' == i) {
30 canvas->restore();
31 canvas->translate(0, image->height());
32 } else {
33 canvas->translate(image->width(), 0);
34 }
35 }
36}